Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Parent Topics: Siebel, Siebel-dev-l

HOWTO:Enable and disable buttons in Siebel 7.x


Edit this entry - Discuss - Rename - Watch - History
Major contributors: sandip_visave, grace12, sreedhar_eim, jvaccaro2 | All Contributors
One of the common tasks assigned to developers working on a Siebel 7 development is enabling
or disabling buttons on an Applet.
Table of contents

Hide TOC

1. Introduction
2. Steps
2.1. Configuration Method
2.1.1. Applet Level
2.1.2. BC Level
2.2. Scripting Method
3. Examples
3.1. Configuration Method
3.1.1. Applet Level
3.1.2. BC Level
3.2. Scripting Method

IntroductionEdit section
There are two methods used to enable or disable buttons. One involves configuration and the
other involves scripting. The complexity of the logic surrounding the button state drives which
approach to take.

StepsEdit section
1. Examine the logic required to enable the button.
1. If the logic is unconditional (for example, always display the My Method button)
then use the configuration method.
2. If the logic is conditional (for example, only enable the Close SR button if all
child activities are Completed) then use the scripting method.

Configuration MethodEdit section


The configuration method can be applied either at the Applet or Business Component level.
Think carefully about where to place the configuration. If it will be needed in many applets based
on one BC, then it is probably best to place it directly on the BC. If it is only likely to be needed
for a single applet, then you may feel it is more appropriate to enable the method only on the
Applet.

Applet LevelEdit section


1. Create a new Applet User Property called "Named Method: MethodName" where
MethodName is the name of the method being enabled.
2. Set the value of this user property to be 'INVOKE', 'MethodName' where MethodName is
the name of the method being enabled.

BC LevelEdit section
1. Create a new BC User Property called "Named Method X" where X is a sequential
number (starting from 1).
2. Set the value of this user property to be "MethodName", "INVOKE", "BC",
"MethodName" where MethodName is the name of the method being enabled and BC is
the name of the business component on which it is enabled.

Scripting MethodEdit section


The scripting method is applicable when the logic needed to enable or disable the button is
complex (for example if you have to look up a field value)
1. Edit the Server script on the Applet
2. Within the WebApplet_PreCanInvokeMethod function enter script for the method that
you need to enable.
o Note that it's essential to minimize any script placed in the
WebApplet_PreCanInvokeMethod event handler as this function is called a lot
of times!
1. If the button is to be enabled the CanInvoke parameter must be set to "True"
(Note this must be "TRUE" in some versions)
2. If the button is to be disabled the CanInvoke parameter must be set to "False"
(Note this must be "FALSE" in some versions)
2. If you have finished processing the logic, then return CancelOperation.
3. If the internal Siebel classes also need to process this request (for example if you're
modifying the behaviour of WriteRecord), then you may need to return
ContinueOperation.
4. Ensure that the script returns ContinueOperation for all methods that you haven't
explicitly dealt with.

ExamplesEdit section
To enable a button invoking the "MyMethod" method on the Service Request List Applet.

Configuration MethodEdit section


Assuming that the button is to be enabled unconditionally.

Applet LevelEdit section


1. On the Service Request List Applet create a new User Property called "Named Method:
MyMethod".
o Set the value of this property to 'INVOKE', 'MyMethod'

BC LevelEdit section
1. On the Service Request BC create a new User Property called "Named Method 1". Note
that the number 1 represents the appropriate value for the 7.7 Sample database for the
Service Request BC. Ensure that you check the appropriate value for yourself.
o Set the value of this property to "MyMethod", "INVOKE", "Service Request",

"MyMethod".

Scripting MethodEdit section


If the button is to only be enabled if the Status field is set to "Completed".
eScript
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
switch(MethodName)
{
case "MyMethod":
//The status field has Link Specification set to True so it will always be Active, so does not
require additional code to acitvate and retreive the value.

if(this.BusComp().GetFieldValue("Status")=="Completed")
CanInvoke = "True";
else
CanInvoke = "False";
return(CancelOperation);
break;
default:
return(ContinueOperation);
}
There is one more way to enable the method Methods that use the naming format
EventMethodxxx do not require any applet or business component script to enable the event. for
example, if we set MethodInvoked='EventMethodTestMethod' you need not use a userpropery
}

You might also like