Identify the caller using menu item name in Ax 2009

Calling the same form with different menuitem, and perform different filter accoding to that menuitem

1.create form

2.create 2 menuitem

3.according to menuitem filter the grid in a different way

Method 1: CODE

public void run()
{

super();

if (element.args().menuItemName() == menuitemdisplaystr(InterfaceMenuItemNoFilter))

{
InterfaceTab_ds.filter (fieldnum(InterfaceTab,CustAccount),InterfaceTab_CustAccount.valueStr());
InterfaceTab_ds.object(fieldnum(InterfaceTab,CustAccount)).allowEdit(false);
}

}

 

Method2: OTHER CODE

public void init()
{
super()
;
// if (element.args() &&
if(element.args().caller())
{
// Make sure this was via a form.
// if(SysDictClass::is(element.args().caller(), classnum(FormRun)))
// {
// Cast the caller and make sure it is the right form.
callerForm = element.args().caller();

if (callerForm.name() == formstr(CustTable))
{
JKG_CustomerInterface_AccountNum.allowEdit(false);
}
//}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s