Inactivate / Activate controls dynamically on button click
The requirement is to inactivate / activate controls dynamically on a button click or through another control. In this example, we are going to control the behavior of two buttons via third button. To bring more clarity let us assume we have 3 buttons as shown in screenshot below:
There is a functionality behind each button- Button A, Button B and Button C. Requirement is that if the user clicks on Button A, then functionality behind Button A should be invoked and at the same time, Button B and Button C should be disabled.
Similarly, if user presses Button B then Button A and Button C should be disabled.
If User presses Button C then Button A and Button B should be disabled.
Follow the below steps to implement this requirement using Scripting at the applet level.
1. In Siebel Tools, query the applet called “Activity List Applet with Navigation” create 3 buttons as below:
Expose these buttons on the UI.
2. In the applet go to Edit Server Scripts and declare 3 global variables as shown below
3. In the applet go to Edit Server Scripts and write the below lines of code in the WebApplet_PreCanInvokeMethod as shown below:
RefreshRecord – without this method, an explicit refresh would be required to see which buttons got disabled at a point of time.
3. In the applet go to Edit Server Scripts and write the below lines of code in the WebApplet_PreInvokeMethod as shown below:
4. Compile the applet called “Activity List Applet with Navigation” and launch the client to find the changes as below
* As soon as Button A is pressed, Button B and Button C gets disabled
** As soon as Button B is pressed, Button A and Button C gets disabled:
*** As soon as Button C is pressed, Button A and Button B gets disabled: