Calling method on a caller form

I created a form LedgerJournalTransDaily(For example) with method callerMenuItemName() and form LedgerJournalTableIPM(For example), i want to call method callerMenuItemName() in  in form LedgerJournalTableIPM(For example).

Solution:

LedgerJournalTableIPM(For example) 

Public MenuItemName  callerMenuItemName()
{
   return  element.args().menuItemName();

}

LedgerJournalTransDaily(For example)  method: 

[FormEventHandler(formStr(LedgerJournalTransDaily), FormEventType::Initialized)]
   public static void LedgerJournalTransDaily_OnInitialized(xFormRun sender, FormEventArgs e)
    {
if(sender.args().caller().callerMenuItemName() == menuItemDisplayStr(LedgerJournalTableIPM))
{
     // Your logic....
}
    }

Comments

Popular posts from this blog

SSRS Report using Controller , Contract and RDP classes in D365

Exporting data to Excel through X++ code

COC for Form level method

How to pass the parameter from one form to another in Dynamic365

Multi Select Lookup in SSRS Report in D365