Monday, November 24, 2014

How to disable export functionality from all list applets in the application?


The Export menu item that appears on all list applets are defined in the applet's class and internally it invokes the standard command "Export (SWE)".


It is possible to disable the Export menu item for all list applets in the application by reconfiguring the standard command "Export (SWE)" to execute a custom business service and then implement code on the PreCanInvokeMethod event to prevent the ExportQuery method from being executed.



1. Create custom business service called "DisableExport" with following server code:




function Service_PreCanInvokeMethod (MethodName, &CanInvoke)

{

if (MethodName == "ExportQuery")
  {
  CanInvoke = "FALSE";
  return (CancelOperation);
  }

return (ContinueOperation);
}




2. Reconfigure the standard Command object "Export (SWE)" with following properties:



business service = DisableExport
target = Server



Note it might be necessary for you to make the Command objects visible in the object explorer, this can be done in the Tools > View >options > Object Explorer screen.

No comments:

Post a Comment