How to fetch the name of the Caller form

rashi.kaushik
Member Posts: 52
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
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
0
Comments
-
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 Developer0 -
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.
rashi0 -
Maruf
there is no function like element.args().caller().name() in Axapta
Thanks in advance
Rashi0 -
rashi.kaushik wrote: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 MugurKind regards,
Ciprian Dudau
Axapta Developer0 -
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.0 -
Thanks Mugur.
I got the solution.
Thanks a lot
Rashi0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions