May 29, 2015

Configure Show More/Show Less buttons on custom List Applets

We have seen lot of out-of-the-box Siebel list applets with Show More/Show Less button which is placed at top right corner. In a recent implementation I had to do the same thing on custom Siebel List Applets. Here is how I did it.

1) Create a Control in your list applet with the below properties:

Name: ToggleListRowCount
Caption: ToggleListRowCount
HTML Bitmap: BTTNS_MORE
HTML Display Mode: EncodeData
HTML Icon Map: ToggleListRowCount
HTML Type: Link
Method Invoked: ToggleListRowCount

2) Edit the Web Layout and place this control at the end in the buttons bar.

3) Compile your changes.



April 9, 2015

List of Values - Clear Cache using eScript

There are 2 ways we can do Clear Cache using eScript:

1) By invoking method "ClearLOVCache" of "List Of Values" BC

  • This method can be used with button controls on any applet based on BC "List Of Values", since this method is available under the business component "List Of Values".

  • This method can also be invoked from other Applet, BC, BS scripts by using below code. 
    var oBO = TheApplication().GetBusObject("List Of Values");
    var oBC = oBO.GetBusComp("List Of Values");
    oBC.InvokeMethod("ClearLOVCache");


2) By using OOTB Business Service (Undocumented)

  • Business Service Details
    • BS Name: LOV Cache Clear Service
    • Method: Activate (This method does not require any input arguments which is logical)

  • Code sample below:
    var bsSvc = TheApplication().GetService("LOV Cache Clear Service");
    var psIn = TheApplication().NewPropertySet();
    var psOut = TheApplication().NewPropertySet();
    bsSvc.InvokeMethod("Activate", psIn, psOut);

  • This Business Service also has another method 'RestoreActivate', use of which is not known to me yet.

  • I also found out that Application Deployment Manager (ADM) invokes this business service to clear LOV cache after the deployment.

April 3, 2015

EAI - Defining Field Dependencies in Integration Objects

Define dependency between fields by using the user properties of the integration component field. The names of these user properties must start with FieldDependency, and it is recommended that the value of each property contain the name of the field on which the associated field is dependent. The EAI Siebel Adapter processes fields in the order defined by these dependencies, and generates an error if cyclic dependencies exist. 

The EAI Siebel Adapter automatically takes into account the dependencies of the fields set by a PickList on the fields used as constraints in that PickList. For example, if a PickList on field A also sets field B, and is constrained by field C, then this implies dependencies of both A and B on C. As a consequence, the EAI Siebel Adapter sets field C before fields A and B. 

User Property Name: FieldDependency<field_name>
Value: Any active integration component field name within the same integration component 

For the complete list Of Integration Object User Properties, refer to bookshelf.

September 25, 2014

Configuration: How to add/change Screen Tab Icons?


We can add or change Screen Tab Icons by making use of Bitmap Categories.


For example, we need to add Screen Tab Icon for Contacts screen.


1) Create a Bitmap Category:

Name: Contacts

Project: <pick_one>


2) Create a Bitmap

Name: Screen Tab Icon

File Name: contacts_icon.gif


File has to be of type GIF and preferably of size 18x18.

File should be placed in /public/enu/images folder




3) Get the Screen name, query for the screen in Siebel Tools.


4) In Siebel Tools menu, click on View --> Windows --> Properties Window (with screen record highlighted in Objects Edit Window). Pick the Bitmap Category, created in Step 1.




5) Compile the Bitmap Category and Screen objects and you are done!


September 22, 2014

Invoking Business Service from Calculated Field Expression


Recently I came across a requirement where in I had to enable/disable a Button on a Applet if all the given conditions are met. The conditions were not that straight forward, I had to go to different BCs (from different BOs) to check them.

The solution I found was InvokeServiceMethod calculated field expression (not recommended by Siebel though)

SYNTAX: InvokeServiceMethod ("My Business Service", "MyMethod", "inputArg1=" + [Field Name 1] + "," + "inputArg2=" + [Field Name 2], "outputArg")

What I did was,
1. Create a Calculated Field "Enable Button"
2. In Calculated Value I used InvokeServiceMethod, which calls a Business Service (method) with RowId as input and returns Y or N.
3. Used this Calculated Field in Applet User Property "CanInvokeMethod: EnableButton".

How InvokeServiceMethod works?
It invokes given method of a Business Service with Input Arguments, Calculated field refers output argument as its Value.

InvokeServiceMethod ("Enable Button Business Service", "EnableButtonMethod", "RowId=" + [Id], "outEnableButton")

My BS code would look something like this:


if (MethodName == "EnableButtonMethod")
{
  var strRowId = Inputs.GetProperty("RowId");
  var strResult = CheckConditions(strRowId);
  if (strResult == "Y")
  {
    Outputs.SetProperty("outEnableButton", "Y");
  }
  else
  {
    Outputs.SetProperty("outEnableButton", "N");
  }
}


It is not advised to use InvokeServiceMethod if the Calculated Field is exposed in UI. Business Service gets invoked every time you step off a record.

May 21, 2014

Scripting: Invoking a Workflow in asynchronous mode

Here is a good way to invoke a Workflow in asynchronous mode. (Workflow Policies are another option)

var bsSvc = null;
var psInput = null;
var psChild = null;
var psOutput = null;

bsSvc = TheApplication().GetService("Asynchronous Server Requests")
psInput = TheApplication().NewPropertySet();
psChild = TheApplication().NewPropertySet();
psOutput = TheApplication().NewPropertySet();
psInput.SetProperty("Component", "WfProcMgr");
psChild.SetProperty("ProcessName", "Health Plan Process"); //workflow name
psChild.SetProperty("Object Id", ContactId);
psChild.SetProperty("Policy Id", PolicyId);
psChild.SetProperty("OGType", "RatePlan");
psInput.AddChild(psChild);
bsSvc.InvokeMethod("SubmitRequest", psInput, psOutput);

April 30, 2014

Executing a SQL through Scripting

Here is the function which takes SQL File Name as imput which is to be executed.

sConnectString = sUserName + "/" + sPswd + "@" + sDBname;
sSQLCommand = "sqlplus" + " " + sConnectString + " @" + vSQLFile;
Clib.system(sSQLCommand);


It looks straight forward but we need to get few important values like SQLFilePath, Username, Password and DBName.


function ExecuteSQL(sqlFileName)
{
    try
    {
        TheApplication().WriteLog("Inside Function ExecuteSQL:Start");
        TheApplication().WriteLog("SQL File Name:" + sqlFileName);

        var boSysPref = TheApplication().GetBusObject("System Preferences");
        var bcSysPref = boSysPref.GetBusComp("System Preferences");
        var sqlPath;
        var vSQLFile;
        var vPropFileName = "/siebel.properties";
       
        //we have stored SQL file path in system preferences
        with(bcSysPref)
        {
            ClearToQuery();
            SetViewMode(AllView);
            ActivateField("Name");
            ActivateField("Value");
            SetSearchSpec("Name", "SQLPath");
            ExecuteQuery();
            if (FirstRecord())
            {
                sqlPath = GetFieldValue("Value");
            }
        }
        vSQLFile = sqlPath + sqlFileName;

        //Read the siebe;.properties file to get Username, Password and DBName
        var propertyFileName = sqlPath + vPropFileName;
        TheApplication().WriteLog("propertyFileName :" + propertyFileName);
       
        var fp = Clib.fopen(propertyFileName, "r");
        var sUserName = "";
        var sPswd = "";
        var sDBname = "";
        var sConnectString = "";
        var sSQLCommand = "";
        var line;
        var Pattern = /\s*$/;

        for (line = Clib.fgets(fp); line != null; line = Clib.fgets(fp))
        {
            var cells = line.split("=");
            var sName = cells[0];
            var sValue = cells[1];

            sName = sName.replace(Pattern, "");
            sValue = sValue.replace(Pattern, "");

            if (sName == "
oracle.siebel.userName")
            {
                sUserName = sValue;
            }
            else if (sName == "oracle.siebel.password")
            {
                sPswd = sValue;
            }
            else if (sName == "
oracle.siebel.db.name")
            {
                sDBname = sValue;
            }
        }

        //Call to execute SQL
        if ((sUserName.length == 0) || (sPswd.length == 0) || (sDBname.length == 0))
        {
            TheApplication().WriteLog("Insufficient DB connection info");
        }
        else
        {
            sConnectString = sUserName + "/" + sPswd + "@" + sDBname;
            sSQLCommand = "sqlplus" + " " + sConnectString + " @" + vSQLFile;
            Clib.system(sSQLCommand);
        }
    }

    catch (e)
    {
        TheApplication().WriteLog("Error in function ExecuteSQL:" + e.toString());
    }

    finally
    {
        TheApplication().WriteLog("ExecuteSQL:End");
    }
}


Amazing! Isn't it? Hope it helps :)

January 24, 2014

Calculating Earliest Start Date and Latest End Date using MVL & MVF

Recently I had a Requirement where in I have a Parent BC and a Child BC. Child BC has records with "Start Date" and "End Date". Each record has different start and end dates. Parent BC has Earliest Start Date and Latest End Date fields.

What I had to do was, find the least of the Start Dates and max of the End Date from the child and populate them at Parent BCs Earliest Start Date and Latest End Date fields.

For determining Earliest Start Date and Latest End Date, as always first thought that came into my mind was achieving this using Scripting :) But I found a better configuration.

Here is what you have to do.

In the Parent BC:

Create a MVL "Parent Child MVL" between Parent and Child BC. (Link between these BCs must have been there)

Create 2 MVFs =======>

Name: Start Date MVF
MVL: Parent Child MVL
Destination Field: Start Date
Type: DTYPE_DATE

Name: End Date MVF
MVL: Parent Child MVL
Destination Field: End Date
Type: DTYPE_DATE

Create 2 calculated fields =======>

Name: Earliest Start Date Calc
Calculated Value: Min ([Start Date MVF])
Type: DTYPE_DATE

Name: Latest End Date Calc
Calculated Value: Min ([End Date MVF])
Type: DTYPE_DATE

You are ready! You can add a small code to read these Calc fields and populate the Parent BC fields Earliest Start Date and Latest End Date! (there might be a better way though)

Siebel is awesome :) 

December 10, 2013

How to do "Generate Triggers" for new WF Policies to work?

"Generate Triggers", this is one of the step that one needs to perform whenever we create new WF Policies and make them work as per the conditions specified for the policy.

Here is the process to do that :
1. Navigate to "Administration - Server Management -> Jobs" view and click on New.

2. Put the Component/Job = "Generate Triggers"

3. Now, in the Job Parameters applet, you need to provide the following four parameters:
a) EXEC : TRUE
b) Remove : FALSE
c) Privileged User : "Database Table Owner Name"
d) Privileged User Password : "Table Owner Password"

4. Click on "Submit Job".

5. After few seconds, refresh the view (by clicking on "Execute Query" button), you will see Execution Server will get assigned to the request and Status changes to "Active".

6. After few minutes, again refresh the record and once the trigger gets generated, Status changes to "Success".

December 4, 2013

Shell script to bounce siebel server after incremental compile


Whenever you make changes to repository objects (SIFs) you will have to move the SRF to your dev environment.

The steps we follow are:
    - Compile your objects on top of the latest SRF from server
    - Stop Siebel Server
    - Stop Gateway Name Server
    - Move your new SRF
    - Start Gateway Name Server
    - Start Siebel Server
    - Run genbsrcipt utility

Below is the shell script that helps you to do the above tasks in a single shell script. Save it as .sh (SIEBEL_STOP_MOVESRF_START.sh) file.
- CHANGE THE PATHS ACCORDINGLY

Here are the steps you need to follow:
1) Copy latest SRF from server(/siebsrvr/objects/enu) into your machine.

2) Compile your objects on top of that.

3) Place the compiled SRF in /u01/SRF folder. If you are using folder with different name make sure you update the variable "SRF_DIR" in the script. DO NOT MISS THIS!

4) Run SIEBEL_STOP_MOVESRF_START.sh
    - Stops Siebel Server
    - Stops Gateway Name Server
    - Takes the backup of existing SRF (/u01/Siebel_8.2.2/siebsrvr/objects/enu) (Renames to siebel_sia_YYYY_MM_DD_hh_mm.srf)
    - Copies latest SRF from "/u01/SRF" to "/u01/Siebel_8.2.2/siebsrvr/objects/enu"
    - Starts Gateway Name Server
    - Starts Siebel Server
    - Runs genbsrcipt utility
    - Deletes the SRF from SRF_DIR


#####################################################

#! /bin/bash

# CONSTANTS
ROOT="/u01"
//location where you place your compiled SRF
SRF_DIR="/u01/SRF"

//SRF directory
SBL_SRF_DIR="/u01/Siebel_8.2.2/siebsrvr/objects/enu"

//Siebel server
SBL_SRVR="/u01/Siebel_8.2.2/siebsrvr"
SBL_BIN="/u01/Siebel_8.2.2/siebsrvr/bin"

//Web server
SBL_WS="/u01/app/oracle/mwhome_1/Oracle_WT1/opmn/bin"

//Gateway server
SBL_GW="/u01/Siebel_8.2.2/gtwysrvr"
SBL_GW_BIN="/u01/Siebel_8.2.2/gtwysrvr/bin"

echo "Stopping Webserver"
cd $SBL_WS
./opmnctl stopall

echo "Setting up Siebel environment"
cd $SBL_SRVR
. ./siebenv.sh

echo "Stopping Siebel Server" 
cd $SBL_BIN
stop_server all

echo "Setting up Gateway Name Server environment"
cd /u01/Siebel_8.2.2/gtwysrvr
cd $SBL_GW
. ./siebenv.sh 

echo "Stopping Gateway Name Server" 
cd /u01/Siebel_8.2.2/gtwysrvr/bin 
cd $SBL_GW_BIN
stop_ns 

echo "Killing additional Siebel processes" 
pkill -9 -f Siebel

echo "Waiting for 60 Seconds for Siebel Server to shut down completely"
sleep 60

#### Set Date and Time Stamp into File Names ####
DATE_TIME=`date +%Y_%m_%d_%H_%M`

# Migration of SRF file
cd $ROOT
chmod 777 SRF
echo "Full permissions given to SRF folder"

cd $SBL_SRF_DIR
echo "Renaming old SRF file"
mv siebel_sia.srf siebel_sia_$DATE_TIME.srf

echo "Copying new SRF file"
cp $SRF_DIR/siebel_sia.srf $SBL_SRF_DIR/siebel_sia.srf

echo "Waiting for 10 Seconds before starting the services"
sleep 10

echo "Setting up Gateway Name Server environment"
cd /u01/Siebel_8.2.2/gtwysrvr
cd $SBL_GW
. siebenv.sh

echo "Starting Gateway Name Server"
cd /u01/Siebel_8.2.2/gtwysrvr/bin
cd $SBL_GW_BIN
start_ns

echo "Setting up Siebel environment"
cd /u01/Siebel_8.2.2/siebsrvr
cd $SBL_SRVR
. siebenv.sh

echo "Starting Siebel Server"
cd /u01/Siebel_8.2.2/siebsrvr/bin
cd $SBL_BIN
start_server all

echo "Generating browser scripts"
./genbscript "/u01/Siebel_8.2.2/siebsrvr/bin/enu/publicsector.cfg" /u01/Siebel_8.2.2/siebsrvr/webmaster

echo "Starting Webserver"
cd $SBL_WS
./opmnctl startall

echo "Removing SRF file from SRF_DIR"
cd $SRF_DIR
rm siebel_sia.srf

echo "Please wait for a few minutes for the Siebel server to startup"

#####################################################

Batch Import of SIFs into Siebel Tools

As a developer you want/need to keep your local tools DB up to date but importing all those objects (SIFs) when there are too many modified objects is a time consuming task.
Normally all development projects will have version control tools like SVN, ClearCase etc. So you will have all changed objects in your local machine.
With the help of below code you can actually perform batch import with overwrite method

STEPS:
1) All you need to to is save the below content (from START to END) as a BAT file. and change the file paths accordingly.
2) Make sure you have closed your local tools before you run this BAT file.
3) Run the BAT file. Your tools instance will open up. Do not close it.
4) After the completion of import tools instance will automatically close.
5) Verify the log if required

===================================
:: START
:: To import SIFs to your local tools from a Folder
set root=D:
set siebeltoolsbin=D:\Siebel\8.2.2.0.0\Tools_1\BIN

::  your tools CFG path
set siebeltoolscfg=D:\Siebel\8.2.2.0.0\Tools_1\BIN\ENU\tools.cfg

:: object location (ex SVN path)
set siebelobjectspath=D:\Objects\Batch_Import

:: Log path
set logpath=D:\SIF_Import_log.txt

:: Datasource
set datasource=Local

:: Username and Password
set username=PDESAI
set pwd=PDESAI

ECHO Parameters set: Importing SIFs to Tools
%root%
CD %siebeltoolsbin%

::Importing the sif files
siebdev.exe /c %siebeltoolscfg% /d %datasource% /u %username% /p %pwd% /batchimport "Siebel Repository" Overwrite %siebelobjectspath% %logpath%

:: END

===================================

Using COMCreateObject to debug scripts

COMCreateObject is one of the better ways  to debug scripts. Here is an example.

function BusComp_PreSetFieldValue(FieldName, FieldValue)
{
    if (FieldName == "Selected APTC")
    {
        //Instantiate
        var WshShell = COMCreateObject("WScript.Shell");
        
        //to display a custom message
        WshShell.Popup("In BusComp_PreSetFieldValue",0,"Siebel");
        
        var sSelectedAPTC = this.GetFieldValue("Selected APTC");
        
        //to display a variable value
        WshShell.Popup(sSelectedAPTC,0,"Siebel");
        
        //to display custom message with variable value
        WshShell.Popup("sSelectedAPTC= "+sSelectedAPTC,0,"Siebel");
        
        //nullify
        WshShell = null;
    }
}

Sample Example:



Most Useful Calculated field Expressions

Below are the most commonly used expressions used in calculated fields. Hope it helps.

- Getting System Preference
IIf ([Is Agent]="Y", SystemPreference("AAA Assister ID Prefix") + Right(RowIdToRowIdNum([Id]),7), "")

- Calculate Age
(Today () - [Birth Date] )  / 365

- LOV Lookup
LookupName("AMS_LOV_APPLTYPE", [Applicant Type])
LookupValue('COMM_BOOLEAN_VALUE', IIf([COB Flg] ='N' or  [COB Flg] Is NULL,'No','Yes'))

- Getting Profile Attribute
GetProfileAttr("ApplicationName")

- Division example
[Assessment Value]/25
IIF([Hire Date] IS NOT NULL,(Today()-[Hire Date])/30,0)
[Equity Value] / [Book Value]

- Multiplication example
[Cost/Share] * [Shares Held]

- ToChar example
IIF([Fax Phone #] IS NOT NULL, '"/fax='+ToChar([Fax Phone #])+'/" <qatest50@qa.test.com>', "")

- Append example
[First Name] + " " + [Last Name]
"" + [Type] + ": " + [Description]
[First Name] + " " + [Middle Name] + " " + [Last Name]

- Getting Application Name
IIF(GetProfileAttr("ApplicationName") = "Siebel Public Sector", "N", [Protect Internal Employee Flag] )

- Getting Parent BC name
IIf (ParentBCName () = "LOY Member", ParentFieldValue ("Member Type"), "")

- Getting Parent BC Field name
IIf (ParentBCName () = "FINS cBanking Request", ParentFieldValue("Company Group Id"), "")
ParentFieldValue("Id") + "_" + [Id]

- Row Id to Number
RowIdToRowIdNum([Id])

- Simple IF example
IIF(IsManagerPosition(), 'N', 'Y')

- Date Time functions
Timestamp ()
IIF(Timestamp()>[Due] AND [Done] IS NULL, "Overdue", "Not Overdue")
Today ()

- Sum the values in MVF
Sum([Client Deposit Balance MVF])

- Count records in MVL
Count("Dealer Trade In")

- Calling business service from calculated field
InvokeServiceMethod ("AAA Calculate Enrolled Product CSR Level Service", "CalculateCSR", "PrimContactId="+[Primary Contact Id]+","+"PlanMedal="+[Plan Primary Coverage Level]+","+"ProductId="+[Product Id],"CSRLevel")

InvokeServiceMethod ("AAA Calculate Applied Premium Assistance Breakdown", "CalcBreakdown", "PID="+[Asset Id]+","+"TPA="+[PD Total Premium Assistance]+","+"PPA="+[Applied APTC],"SPAUsed")

- Link in calculated field
"<a href=# onClick=""window.open('http://10.10.10.79:8080/alfresco/d/d/workspace/SpacesStore/bffe76c5-3d18-4d9d-930a-50b9cd10e477/" + [App PDF Link] + "','_blank');return false;"">" + [App PDF Link] + "</a>"

- Other Examples
GetNumBCRows ("FINS Health Individual Policy", "FINS Member Benefits", '[Policy Coverage Id] ="'+[Id]+'"',"All")

GetNumBCRows ("HLS Case", "HLS Case", "[Status]= 'Closed'", "Sales Rep")

Max([PD Member End Dates])

IfNull([Graphical Policy Status Green], IfNull([Graphical Policy Status Yellow], IfNull([Graphical Policy Status Red], "Current Outage")))

Mid(Today(), 4, 2)

Left(Today(), 2)

Right(Today(), 2)

IfNull([Graphical Policy Status Green], IfNull([Graphical Policy Status Yellow], IfNull([Graphical Policy Status Red], "Current Outage")))

IfNull(Count ("Case QA Template"), 0)

IIf (LPDinId() <> [Created By],"Y","N")

(1.0 - [Cost]/IfNull([Promotional Price],[List Price]))*100.0

IIf (ParentBCName () = "Admin Price List" OR ParentBCName () = "Price List", ParentFieldValue ("Currency Code"), "")

ToChar([Service Length])+ " " +[Service Length UoM]

IIF(ParentFieldValue ("VerItm") LIKE "Inc*","Income", IIF(ParentFieldValue ("VerItm") LIKE "Exp*","Expense", IIF(ParentFieldValue ("VerItm") LIKE "Household C*","Household Composition", IIF(ParentFieldValue ("VerItm") LIKE "Res*","Resource" , "Field"))))

BCHasRows("FINS Health Individual Policy","FINS Member Benefits","[IHP Product Id]='" + [IHP Product Id] + "' AND [Insured Id]='" + [Insured Id] + "' AND ( [PD Policy Status] <> 'Terminated' AND [PD Policy Status] <> 'Lapsed')" ,"All")

LookupName("FINCORP_PROD_ADMIN_CLASS_MLOV", [Product Type])

IIf (([End Date] >= Timestamp()) AND ([Start Date] <= Timestamp()),Y,N)

IIF(ParentBCName() = "FINS Member Benefits", ParentFieldValue("IHP Product"), ParentFieldValue("Product Name"))

Left([Street Address],[Street Address Len])+ [Calculated Address Comma0.5] + [Street Address 2] + [Calculated Address Comma1]  + [City] + [Calculated Address Comma2] + [State]

Querying List Of Values BC in eScript

Many times we come across situations where in we need to perform query on List Of Values BC to get a value. What we usually do is by instantiating BO and BC then perform query.

There is a vanilla method for querying List of Values.

TheApplication.InvokeMethod("LookupValue", type, lang_inde_cd);
//it returns 'Value'

var LOV_Val=TheApplication().InvokeMethod("LookupValue","SR_SUBAREA","WASIN");

Calculate 18 years age Flag including leap years

Ways to calculate 18 years age Flag including leap years:

1. Create Calculated Field of todays date in YYYYMMDD Format:
e.g: Formatted Today Date : ToChar(Today(),'YYYY') + ToChar(Today(),'MM') + ToChar(Today(), 'DD')
            Field Type: DTYPE_NUMBER

2. Create another Calculated Field Birth date in YYYYMMDD Format:
e.g: Formatted Birth Date : ToChar([Birth Date], 'YYYY') + ToChar([Birth Date], 'MM') + ToChar([Birth Date], 'DD')
            Field Type: DTYPE_NUMBER

3. Set the Calculated Age Under 18 Flag as mentioned below:
            Age Under 18 Flg : IIf(([Formatted Today Date] - [Formatted Birth Date]) < "180000", "Y", "N")
            Field Type: DTYPE_TEXT

You are done!

ShowModalDialogue method in Browser Script

Lets say you are trying to open your facebook profile in a modal window. Below is the code to achieve it. Refer bookshelf for more details on ShowModalDialog.

function Applet_PreInvokeMethod (name, inputPropSet)
{
        if(name == "OpenProfile")
        {
                    var sProfileName = this.BusComp().GetFieldValue("Name");
                        var sURL = "https://www.facebook.com/"+sProfileName;
                   
                    var sOptions = "dialogHeight:400px;dialogWidth:600px;dialogTop:100px;edge:sunken;resizable;yes";
                    //alert(sURL);
                    theApplication().ShowModalDialog(sURL, "", sOptions);
                    return ("ContinueOperation");
        }
        return ("ContinueOperation");
}

Calling Business Service from browser script

//Version 8 and above
Add a Application User Property (in siebel tools) 
Name: ClientBusinessService9
Value: Your Business Service Name
Note: No need to make changes in client.cfg

//Version 7.x and below
locate [InfraUIFramework] section in your client CFG, add the BS entry as shown below
[InfraUIFramework]
ClientBusinessService[n]   = "Your Business Service Name"

//Invoking the BS from browser script
function Applet_PreInvokeMethod (name, inputPropSet)
{
        if(name == "OpenCOC")
        {
                    var psIn = theApplication().NewPropertySet();
                    var psOut = theApplication().NewPropertySet();
                    psIn.SetProperty("Type","URL");
                    var sService = theApplication().GetService("Your Business Service");
                    psOut = sService.InvokeMethod("GetURL", psIn);
                        //where as in server script the syntax will be
                        //sService.InvokeMethod("GetURL", psIn, psOut);
                        
                    var sCoCURL = psOut.GetProperty("URL");
                    return ("ContinueOperation");
        }
        return ("ContinueOperation");
}

Date Comparison: Compare a given date with Today() in eScript

function fnCompareCurrDate(dDate)
{
     try
     {
           var curdate = new Date();
           var curM = ToInteger(curdate.getMonth() + 1);
           var curD = ToInteger(curdate.getDate());
           var curY = ToInteger(curdate.getFullYear());
          
           var effdate = new Date(dDate);
           var effM = ToInteger(effdate.getMonth() + 1);
           var effD = ToInteger(effdate.getDate());
           var effY = ToInteger(effdate.getFullYear());


           if ((curY == effY) && (curM == effM) && (curD == effD))
           {
                return (1);
           }
           else
           {
                return (0);
           }
     }

     catch (e)
     {
           TheApplication().WriteOneGateLog("Error in function fnCompareCurrDate:", e.toString());
     }

}