How to fetch the name of the Caller form

rashi.kaushikrashi.kaushik Member Posts: 52
edited 2006-03-06 in Dynamics AX
Hi all

I want to perform a particular operation on a form only if it is called from SalesTable form.
Can anyone tell me how can I get the name of the caller form.
I am trying this.args().caller()==??

Thanks in advance
Rashi

Comments

  • MugurMugur Member Posts: 93
    Hi,

    The answer is element.args().caller().name(). In the same way, you can also force the element.args().caller() to execute other methods (custom methods), if you are sure the caller is f.i. SalesTable.
    Kind regards,

    Ciprian Dudau
    Axapta Developer
  • rashi.kaushikrashi.kaushik Member Posts: 52
    Let me explain in detail.
    I am modifying the SysSetUpformRun class to throw a warning when i try to run a child form from the SalesTable form e.g. MarkUpTrans depending upon a particular condition.

    if(!IGNFormList::find(this.form().name()).FormName)
    {
    if(this.args().caller())
    {
    throw error(" ");
    }
    }
    This throws error whenever the form is called from any of the parent forms PO or SO.
    How will i display the error only if the caller form is ST form.

    Thanks in advance.
    rashi
  • rashi.kaushikrashi.kaushik Member Posts: 52
    Maruf

    there is no function like element.args().caller().name() in Axapta

    Thanks in advance
    Rashi
  • MugurMugur Member Posts: 93
    Maruf

    there is no function like element.args().caller().name() in Axapta

    Thanks in advance
    Rashi

    Yes, it is not explicitely, but since you are sure that the caller is a formrun, and since the formrun has the name() method, you can pass it it that format, e.g. element.args().caller().name(). This is only raising errors if the caller is a class (since classes do not have name()).

    PS: it's not Maruf but Mugur :D
    Kind regards,

    Ciprian Dudau
    Axapta Developer
  • rashi.kaushikrashi.kaushik Member Posts: 52
    Mugur

    First of all i m sorry. I just misspelled ur name.

    If i try
    if(archiveDBParameters.IncludeArchiveDB)
    {
    if(!IGNFormList::find(this.form().name()).FormName)
    {
    if(this.args().caller().name() == "SalesTable")
    {
    throw error(" ");
    }

    }
    }

    it doesnt allow me to open any of the forms when the first IF condition is satisfied i.e. archiveDBParameters.IncludeArchiveDB is true.
  • rashi.kaushikrashi.kaushik Member Posts: 52
    Thanks Mugur.
    I got the solution.

    Thanks a lot
    Rashi
Sign In or Register to comment.