Suppress menu item across the entire application

Requirement

Remove the "Save Target List", "Applet Target List", "Apply List" and "Save List" options from the applet menu.

These options are on the Siebel 8 menus and enabled by default, the problem is that there are 500+ applets, and we needed a global solution to remove them from the entire application.



A SR was lodged and the solution from Siebel was simple, go into the 500+ applets and disable the menu items individually. This was not exactly the practicle solution that we were after.

For customers out there who have similiar requirements to remove items from the menu. Here are 2 alternative global configuration options that allow us to achieve the above requirement.

1. PreCanInvoke on Command Object

Co-incidently Alex from Siebel Essentials has highlighted this behaviour in his recent post.

We can disable or enable a menu command by configuring the PreCanInvoke of the Business Service that the command calls. This is what the command object for our menu item looks like.



We can see that "Apply Target List", "Save Target List" and "Save List" call methods on the Business Service "SLM Save List Service". To disable both of these menu items, we can use the following PreCanInvoke code to grey out these options in the menu.

function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{
var iOperation = ContinueOperation;

switch(MethodName)
{
case "CreateSaveListPopup":
case "CreateApplyListPopup":
CanInvoke = false;
iOperation = CancelOperation;
break;
}

return (iOperation);
}


"Apply List" seem little tricker because it dosnt call a Business Service, instead it calls a class method. Since we dont need this command anymore, we can just override the Method and Arguments with the Business Service and Method that we have just disabled.



This allows the command to utilize the PreCanInvoke powers of the Business Service to grey our desired menu items. If you are concerned that the business service you are disabling is used elsewhere in the Application. You can always substitute it with a dummy Business Service with disabled methods.

2. Supress Menu Item from Applet Class

This option was provided by JM, an ever resourceful colleague. This technique entails that we go directly to the class object that all list applets inherit, and disable the menu item from there.

Simple and elegant!

Navigate to the Class "CSSSWEFrameList", and goto the Class Method Menu Item object, you will see the following options.



Click the "Supress Menu Item" option for these menu items, and re-compile. You will notice that instead of being greyed out, the menu items have dissppeared.

Remember that this technique hides the menu item, it dosnt disable them. So if you have keyboard accelerators for your commands, the user can still invoke the action using the shortcuts, unless those are disabled as well.

To finish the job, we need to also disable the options from the Application Menu, this can be done by disabling the menu item from the Menu "Generic Web".




Conclusion

Both these solutions allow you to disable the menu items globally in the application.

The first option has the advantage that you can conditionally enable and disable these commands based on condition, while the second option is nicer if you dont need the menu item at all.


7 comments:

  1. We disable the export command using the class method. It is excellent - we actually have two srf's that we compile, one with export capabilities that we've configured an object manager for (which only a few people have access to) and then a version for everyone that has the export facility disabled. We exported the changes (enable/disable) into two sif files. We then use a build script to apply the disable sif, build the main srf and then apply the enable sif to build the other srf. It works great!

    ReplyDelete
  2. An excellent post for Novices cum professionals. But when I try using the same for "ChangeRecords" option, I am unable to accomplish it i.e., the menu item is still enabled. Can you please advise me on this? Looking forward to your reply...

    ReplyDelete
  3. If you want to disable the Command, option 1 should work, otherwise goto the Command and remove the method that it invokes.

    If you want to hide the Command, goto the Menu object, and make the Command inactive.

    Jason

    ReplyDelete
  4. Hi We have a requirement where we need to remove the New Query or Run Query or Refine Query,Record Count,Print, Preview Print etc. Please let me know in which class they are present and what is the approach.
    Regards.

    ReplyDelete
  5. Hi We have a requirement where we need to remove the Menu Items New Query,Run Query Refine Query,Record Count,Print,Preview Print.
    Please let us know in which class these are present and also the approach.
    Regards,

    ReplyDelete
  6. Goto the flat tab of your tools and search for the menu item under Class Method Menu Item, and disable it from that class.

    You may not be able to disable fundamental methods such as Query universally across the application, so the fallback would be to disable it on the applet level.

    ReplyDelete

Comments are open to all, please make it constructive.