How To Disable Applet Menu Item

This Article has been submitted by Sai Kiran Anand a reader of my Blog. This is nice tip can be helpful.

Requirement:

Enable the Copy Record option in menu items, at the same time should Remove New Record from Menu items.

Solution:

If the requirement was to disable both Copy Record and New Record then we could have checked No insert = True but here we wanted Copy to remain enabled and New Record to get disabled. Sai Kiran pointed out a rather simple method to achieve the same thing.

  • Go to Applet > Applet method menu item
  • Create a New Record 
  • Enter the following values in the field
    Command: New Record (SWE)
    Menu Text: New Record
    Position: 1
    Suppressed menu item: True

It will remove the New Record option from menu items and Copy Record is also enabled. By this way, we can disable all the unnecessary menu items 🙂

I have not tried this personally, so just a word of caution New Record might still be available through keyboard shortcut. In case if you want to disable it completely then add the following lines in the BC Pre Invoke

if (MethodName == "NewRecord")
   return(CancelOperation);

6 Responses to How To Disable Applet Menu Item

  1. You can set the ‘No Insert’ and ‘No update’ property to True at Applet level to disable ‘New Record’ and ‘Copy Record’.

  2. Sai Kiran, its true. The menu item will be suppressed and keyboard short cut is still enabled if we use the Applet Method Menu Item.
    Better to go for scripting on the server scripting :-

    function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
    {
    if (MethodName == “NewRecord”)
    {
    CanInvoke = “False”;
    return (CancelOperation);
    }

    return (ContinueOperation);
    }

    I tested it – It worked fine. Disabled the menu item, and keyboard short cut also disabled.

    • How about CanInvokeMethod: CopyRecord FALSE Applet User Prop, Scriptless solution, can be used for Delete Record and New Record similarly

Leave a Reply

Contribute