How to enable or disable a button conditionally in Siebel Open UI

Enabling or disabling a button conditionally is pretty common requirement in Siebel configuration. There are many ways to do so, you can choose any of these based upon your requirement but as you know, it is always advisable to get rid of scripting as much as possible.

1) Script in PreCanInvoke Event
2) Named Method
3) EventMethod
4) ‘CanInvokeMethod’: Applet User Property
5) Javascript (only in Siebel Open UI)

1) Script in PreCanInvoke Event
– This is the scripting way to enable or disable a button conditionally in Siebel
– Select the applet, do right click and script in ‘Webapplet_PreCanInvoke’ event
Suppose on Contact List Applet, ‘Create Quote’ button should be enable only when contact status is ‘Active’.
To meet this requirement, we could add script in PreCanInvoke event of Contact List Applet. In script, first check the value of Contact Status field, if it is ‘Active’, then CanInvoke = TRUE else FALSE.

Sample Script:
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
  if ( MethodName == “CreareQuote” )
// Method name
   {
       CanInvoke = “TRUE”;
       return( CancelOperation );      
   }
}
return (ContinueOperation);

2) Named Method
– It is scriptless way to enable a button conditionally
– Can be used in Applet level or BC level
Syntax
   Name: Named Method n: Method Name
   Value: ‘INVOKE’, ‘method name’

3) EventMethod
– Just prefix ‘EventMethod’ with the name of ‘Method Invoked’ (Control level property)
Syntax
   Method Invoked = EventMethodCreareQuote
– No need to script in PreCanInvoke event
– Button will be always active if method name is prefixed with EventMethod, it does not allow to add any condition

4) ‘CanInvokeMethod’: Applet User Property
– Can enable or disable a button conditionally in Siebel
– Applet level user property, supported by Siebel 8.0 or higher version
Syntax
   Name = CanInvokeMethod: CreareQuote
   Value = TRUE

5) Javascript
– This is the new way to enable or disable a button conditionally but applicable only in Sieble Open UI
– Complete repository independent and can be modified anytime as per requirement
– Will be covered in details in Siebel Open UI training articles

Note:
– Avoid scripting in ‘PreCanInvoke’ event as much as possible and use ‘CanInvokeMethod’ user property as an alternative

Need any help!! Please feel free to comment here.
To know more, follow ‘TechOneStop on Facebook / Twitter / LinkedIn / Goolge+. 
SBL-DBC-00105 / ORA-00904: An error has occurred executing a Sql statement
DBCHCK utility - check Siebel database health

Speck Your Mind