Applications Administration Guide > Configuring the Inbox > Examples of Inbox Triggers >

Inbox Trigger Using Server Script

This section presents a sample Server Script that calls Inbox methods.

This code is entered in the PreWriteRecord statement for the Project business component in Siebel Tools. The purpose of this code is to take data from the project record as well as some required arguments to invoke the Universal Inbox business service under the Initialize method. When the user changes the value of the Status field to For Approval, this eScript code is launched, invoking the Universal Inbox business service and creating an Inbox item based on the parameters specified in the eScript and the Inbox type.

function BusComp_PreWriteRecord ()
var FldProjectStatus = this.GetFieldValue("Status");

if (FldProjectStatus == "For Approval")
var szScriptSessionId;
var szRequester;
var svc;
var indata;
var outdata;

indata =TheApplication ().NewPropertySet ();
outdata = TheApplication ().NewPropertySet ();

// Get the login name of the user
szRequester = TheApplication ().LoginName ();

// ItemObjectId, ItemType, ItemSubmittedBy, and ItemDescription are the
// required input arguments for the "Universal Inbox.Initialize"
var FldProjectNum = this.GetFieldValue("Project Num");
indata.SetProperty ("ItemObjectId", FldProjectNum);
// Item Type is the Approvals Inbox type defined in the
// Approvals Inbox Administration screen
indata.SetProperty ("ItemType", "ChangeManagement");
// Short Description of the inbox item
indata.SetProperty ("ItemDescription", FldProjectNum);
indata.SetProperty ("ItemSubmittedBy", szRequester);

// ItemQueueDuration, ItemPriority, and ItemComments are the
// optional input arguments for the "Universal Inbox.Initialize"
indata.SetProperty ("ItemQueueDuration", "129600");
indata.SetProperty ("ItemPriority", "High");
indata.SetProperty ("ItemComments", "Change Management Project");
svc = TheApplication ().GetService ("Universal Inbox");
svc.InvokeMethod("Initialize", indata, outdata);

return (ContinueOperation);

Applications Administration Guide