Pages

Tuesday, January 24, 2017

Enable/Disable Export menu item conditionally in list applets

Enabling or disabling a button conditionally is pretty common requirement in Siebel. 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. Here I will only describe about one method which is easy and script less.

We use applet user properties for this configuration.

Method of configuration

By default "Export" is enabled in list applet menu. So we will create a responsibility, for which we will disable the menu item "Export". Who ever the users assigned with this responsibility will see "Export" as disabled in the list applet. 

Step 1.
Create a responsibility and assign a test user. (Eg. We create "No Export" responsibility). No need to associate any views.
For more information in creating a responsibility, refer below link
https://docs.oracle.com/cd/E14004_01/books/DevDep/CompanyStructure6.html

Step 2.
Find the applet you want to restrict the "Export" (Eg. We'll select "SIS Account List Applet" for this)

Step 3.
Go to Siebel Tools and query the applet 'SIS Account List Applet' and go to Applet User Properties.

Step 4.
Create new record where Name= 'CanInvokeMethod: ExportQuery' and Value = GetProfileAttrAsList("User Responsibilities") NOT LIKE "*No Export*"

Step 5.
Compile the object changes to srf and check with the user user login assigned with above responsibility.

Explanation;
 1. CanInvokeMethod : is used to define whether the button or other user property should   be enabled or disabled.
          Syntax : Name = CanInvokeMethod: MethodName
                        Value = TRUE/FALSE

 2. GetProfileAttrAsList(“User Responsibilities”) : is used to get the responsibilities assigned for the current logged in user. This will be retrieved as a comma separated list

 3. InList : Will determine whether the given string in the first argument is in the second  comma seperated list"



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

Feel free to comment here..