Thursday, Jan. 18, 2018

Disable a Custom Method in a Query mode

Written By:


August 18, 2012


Posted In:


The requirement is to hide custom button called “Test” from the Opportunity Form Applet when the applet is placed into query mode. However, user should be able to invoke the logic behind the button in other applet modes.

Follow the steps below to achieve this requirement:

1. Create a Custom button on Opportunity Form Applet with following properties:
Method Invoked = FilePopup (Any custom method name can be written)
HTML Type = MiniButtonEdit
Caption = Test

2. In the Applet -> Server Script, write the below code:

a. In the declarations section, declare a global variable as
var appletmode = “NOTQUERY”;                     //Applet is initially not in query mode

b. Write the below lines of code in PreCanInvokeMethod of this applet:

function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
case ‘FilePopup’:                              //Check for the custom method name
if (appletmode == “QUERY”)
CanInvoke = “FALSE”;                          //Disbale the method
CanInvoke = “TRUE”;                           //Enable the method
return (CancelOperation);
return (ContinueOperation);

Notes: when the applet is first loaded in the Siebel client application, this PreCanInvokeMethod gets fired with search on MethodName = “‘FilePopup’“. The Statement called CanInvoke = “TRUE” is executed and Button “Test” is enabled on the UI in Siebel Client application.

Applet_PreInvoke and Applet_Invoke methods are not executed at this moment keeping the global variable set to a value as appletmode = “NOTQUERY”.

c. Write the below lines of code in PreInvokeMethod of this applet:

function WebApplet_PreInvokeMethod (MethodName)
switch (MethodName)
case “NewQuery”:                                                                     //Vanilla method called when “Query” button is pressed on the applet
appletmode = “QUERY”;

case “UndoQuery”:                                                                   //Vanilla method called when Esc Key is pressed on keyboard OR when applet leaves the query mode
appletmode = “NOTQUERY”;

case “ExecuteQuery”:                                                               //Vanilla method called when “Go” button is pressed on the applet in Query Mode
appletmode = “NOTQUERY”;

case “FilePopup”:                                                                      //Name of the custom method
//Put your logic here
}//end switch
return (ContinueOperation);


* When the applet is first loaded, Test button is enabled on the UI.

**. When the Query button is pressed on the UI, “NewQuery” method is invoked. The execution passes from PreCanInvokeMethod to PreInvokeMethod and searches for MethodName = “NewQuery”. Appletmode global variable is set to “QUERY” and the break statement causes the execution to move out from PreInvokeMethod to PreCanInvokeMethod and searches the methodname as “FilePopup” with global variable=”QUERY”.

Statement CanInvoke = “FALSE” is executed and “Test” Method is disabled from the UI.

3. Compile the applet and launch the Siebel Client application.

Share This Article

About Author


Hi, I am sharing my experience to alleviate beginners with open UI and HI version of Siebel CRM. I work in Sun Life Financials and can be reached via IT Tool box as well. Thanks.

  • Kamal

    This can be achieved using the HTML Type property values of MiniButtonEdit, MiniButtonNew, etc. which were created to auto hide and expose buttons in or out of Edit and Query modes.