Dynamically Enabling/Disabling applet buttons (based on conditions) and Suppressing Applet Menu Methods (Menu Options)
This post is to explain about enabling/disabling/Suppressing menu options which are appearing at Applet level.
For Enabling/Disabling Applet Menu Options :
- Go to the respective applet (e.g. Account List Applet). Under applet navigate to ‘Applet Method Menu Items’ and query for the ‘Menu Text’ (e.g. here ‘New’ option which is appearing in UI under the ‘Menu’ drop down).
- In ‘Command’ object query for the Name ‘New Record (SWE)’ and make a note of ‘Method’ (e.g. NewRecord).
- Add the below code in ‘WebApplet_PreCanInvokeMethod’ to enable menu option based on condition.
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if(MethodName == ‘NewRecord’)
{
—Check for the conditions—
if(Condition evaluates to true)
{
CanInvoke= ‘TRUE’;
}
else
{
CanInvoke= ‘FALSE’;
}
return (CancelOperation);
}
else
return (ContinueOperation);
}
- Use the similar approach and set CanInvoke= ‘FALSE’ in the above code to disable the button conditionally.
For Suppressing(hiding) Applet Menu Options :
For suppressing menu item (i.e. For hiding the ‘New’ option in this case) in menu drop down, make Suppress Menu Item to ‘TRUE’.
Happy reading@Optanium!!!