Siebel Applications Administration Guide > Signature Capture > Process of Creating the Applet for Signature Capture >

Adding Browser Script to the Applet


To access the ActiveX control, and to execute methods as required, you must add browser script to the applet.

This task is a step in Process of Creating the Applet for Signature Capture.

To add browser script to the applet

  1. In Siebel Tools, right-click the applet object, then choose Edit Browser Scripts.
  2. Write the script to perform the following functions:
  3. Choose File > Save.

Example Applet_Load Event

The following example code retrieves the data for the current record, and displays the data in the signature control applet when the applet is loaded.

function Applet_Load ()

{

//when the applet loads check the BC field value

//and use it to set the signature control value

//control is clear by default so no call to clear here

var inPS;

var iResult;

var sigVal;

inPS = TheApplication().NewPropertySet();

sigVal = this.BusComp().GetFieldValue("AA Signature");

if (sigVal.length >1)

{

inPS.SetProperty("InkVal", sigVal);

iResult = this.InvokeMethod("SetInk", inPS);

}

}

Example Applet_ChangeRecord Event

The following example code updates the data in the signature capture control when that data changes, for example, when a new record is selected.

function Applet_ChangeRecord ()

{

//when the BC record changes then check the BC field value

//and use it to set the signature control value

//or clear the signature control value

var inPS;

var iResult;

var sigVal;

inPS = TheApplication().NewPropertySet();

sigVal = this.BusComp().GetFieldValue("AA Signature");

if (sigVal.length >1)

{

inPS.SetProperty("InkVal", sigVal);

iResult = this.InvokeMethod("SetInk", inPS);

}

else

{

iResult = this.InvokeMethod("ClearInk", inPS);

}

inPS = null;

}

Example Applet_PreInvokeMethod Event

The following example code manages the logic for the buttons and for the other scripts.

function Applet_PreInvokeMethod (name, inputPropSet)

{

if (name=="StoreSignature")

{

//code to store signature value

var myOcx;

//get the signature aX control

try {

myOcx = this.FindActiveXControl("CICInk");

}

catch (e) {

alert ("the error is "+ e.toString());

alert ("the message is "+e.message);

}

//code to get the value in the control

//and then write it in the BC field

var lnInk;

var objBC;

lnInk = myOcx.Ink();

objBC = this.BusComp();

objBC.SetFieldValue("AA Signature", lnInk.toString());

objBC.WriteRecord();

return ("CancelOperation");

}

else

if (name == "ClearInk")

{

//code to clear the signature control value

var axCntl;

axCntl = this.FindActiveXControl("CICInk");

axCntl.ClearInk();

return ("CancelOperation");

}

else

if (name == "SetInk")

{

//code to set the signature control value

//InkVal comes from applet_load and applet_changerecord

var strInk;

var axCntl2;

strInk = inputPropSet.GetProperty("InkVal");

axCntl2 = this.FindActiveXControl("CICInk");

try{

axCntl2.Ink(strInk);

}

catch (e) {

alert ("the error is "+ e.toString());

alert ("the message is "+e.message);

}

return ("CancelOperation");

}

else

{

return ("ContinueOperation");

}

}

Siebel Applications Administration Guide Copyright © 2009, Oracle and/or its affiliates. All rights reserved. Legal Notices.