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()==??
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.
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.
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()).
Comments
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.
Ciprian Dudau
Axapta Developer
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
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
Ciprian Dudau
Axapta Developer
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.
I got the solution.
Thanks a lot
Rashi