Tuesday, January 24, 2012

A few tricks with setTimeout() in Siebel

setTimeout() allows you to execute a browser script at some point in the future.

It takes two parameters:
  •  a function to call
  •  time to wait in milliseconds.
Auto refreshing applet:

Let’s say we have a requirement to refresh certain list applet every couple seconds or so. To reach this goal we might use setTimeout() to refresh the applet at equal intervals.

Open Browser Script editor on your applet and create a function:

function Refresh()
var oMyApplet = theApplication().FindApplet ("Your_Applet_Here");
if (oMyApplet) {
oMyApplet.InvokeMethod ("RefreshBusComp");
setTimeout ("Refresh()", 5000);

This function will find your applet and refresh it. It will also schedule itself to be reinvoked in 5 seconds.
The only thing left is to call this function for the first time. A perfect place to do it – Applet_Load event.

function Applet_Load ()
setTimeout ("Refresh()", 5000)

Flashing control/label:

Assume the requirement: draw user attention to a critical field if it has invalid or questionable data.
One way to do this is by making the field flashing red for example. 

We’ll start with creating our main function

(Browser Script):

function Flash()
var oMyApplet = theApplication().FindApplet ("Your_Applet_Here ");
if (oMyApplet) {
var oMyControl = oMyApplet.FindControl ("Your_Control_Here");
if (oMyControl.GetProperty ("FontColor") == "#FF0000")
oMyControl.SetProperty ("FontColor", "#000000");
oMyControl.SetProperty ("FontColor", "#FF0000");
setTimeout ("Flash()", 200)

And to invoke this function for the first time:

function Applet_Load ()

This way the field will flash red 2.5 times a second. You may enhance the script by adding data validation or even use gradient transition .

You might as well flash the control’s label rather than the text. In order to do so you will have to add a control user property useLabelID with value TRUE and use oMyControl.SetLabelProperty instead of oMyControl.SetProperty.

Siebel Format Date Strings Within a Workflow Process Without Having to Resort to Script

It's possible to have a requirement to compare dates coming from different sources such as Field Values, Methods (Timestamp or Today), or Integrations. They may be in different formats making comparisons sometimes difficult.

Being able to format a date string to be similar to another format is useful and doing so without Script is very desirable. This post shows a Workflow technique using the ToChar Method to format date strings without Script where both the input date and the format are dynamic process properties.


Create a Workflow process with three process properties:

1. BeforeDate
    a. Type: Date
    b. Default Date (for testing only) 08/11/2011 06:06:54

2. AfterDate
    a. Type: String

3. DateFormat
    a. Type:String
    b. Default String: "M/DD/YY"
NOTE: The Process Property that holds the input date must be of type Date. If one tries to use String as the Data Type for the Process Property holding the input date the format will be ignored in the ToChar Method and the date will simply be copied as a string to the Output Process Property.

Add three steps to the Workflow.

1. Start

2. Business Service
    a. Business Service Name: Workflow Utilities
    b. Business Service Method: Echo

3. Add an Output Argument to the Business Service step with the following properties.
    a. Property Name: AfterDate
    b. Type: Expression
    c. Value: ToChar([&BeforeDate], [&DateFormat])

4. Connect them so that the final Workflow Process looks like this figure 1.


Figure 1 This is the way the test workflow looks.
5. The ToChar Method will take our input date and our desired format and produce a string in the format desired. When simulating the Workflow one can see the input and output in figure 2.

Figure 2 This is the resulting formatted date string

M = Month as a single digit
MM = month as two digits
m = minutes as single digit
mm = minutes as two digits
DD = two digit days
YYYY = four digit years
HH = hours
MM = minutes (if after the hours token)
SS = seconds

Thursday, January 19, 2012

Using BitMaps in Siebel

We often use images for distinguishing the state of a Policy/Quote, i.e. we use different icons (color) as a immediate notification for the change in State.

For ex: when the Policy is in Pending State the Icon will show a Red Color (Pic 1), where as when the Policy is in “Accepted by Customer” state the Icon will be in Green Color (Pic 2).

Step 1: Create a Bitmap Category
Add Bitmaps for that Category.

Step 2: In the Bitmaps u chose the files (.gif) that u want to show in the Screen. (Images that gets
The file name refers to the .gif files located in the images folder in

Step 3: In the Icon Maps Create a new record.
In the Icon List Create new Records.
In Name Give a Name for Icon record created. In the Bitmap provide the name of the Bitmap created in
the step1. In the Bitmap Category put the name of Bitmap Category created in step 1.

Step 4: Create a new control in the Applet where u need to use the Bitmap.
In the HTML Icon Map option (of the newly created control) adds the Icon Maps that was created in

We can create calculated fields to Map the Icons to a specific value of a field.
For example: In the BC “FINS Group Policy” we have a Field Policy Status LIC that is having a static
Picklist. Depending on the Value of the Field that is chosen (from the static Picklist), the value in the
Calculated fields e.g.“Graphical Policy Status Yellow” changes to “Diminished Service”.

We see in the Icon List “Diminished Service” is mapped to Stoplight – Yellow Light.
So whenever a different value is chosen in the Picklist the Value of the field Graphical Policy Status
changes, which in turn is mapped to the Icon Maps and the Icon changes.

Sunday, January 15, 2012

Validation without Scripting

You want to check/search in child Bus comp field values for some validation without scripting?.

For Example: 
       When the Specified Account has any child M Activities attached the Customer Activity flag should be true
      Implementation without scripting:
      Create a calculated field: Check Activity
  • Calc Expression: BCHasRows(“Account”, “Action”, “'[Account Id] ="' + [Id] +'"‘ AND  [Type] = “ZM”, ”,“All”)
      Return Y, if any child activity found.
      – Create a User property “On Field Update Set” to set the Activity Flag ; Value : “Check Activity”, “Activity Flag”
SyntaxBCHasRows (BO, BC, search_expr, visibility)
Where we can use: Calc fields, workflows, Data Validation Manager Rule, FINS Validator
Scenario 2:
If you want to get child Bus Comp Record count without scripting?

For Example: 

The End Date of any Service Request should not be modifiable if any child Activity Status is Active, the customer wants error message.

Implementation without scripting:
  • Create a calculated field: Check End Date
  • Calc Expression : GetNumBCRows (“Service Request”, “Action”, “'[SR Id] ="' + [Id] +'"‘ AND  [Status] = “Active”, ”,“All”)
  • Return child record count
  • Set Validation Property for Service Request  End Date to avoid modification
  • Value: [Check End Date] <1
            Syntax: GetNumBCRows (BO, BC, search_expr, visibility)

Where we can use: Calc fields, workflows, Data Validation Manager Rule, FINS Validator