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

Inbox Trigger Used in ESS


This section presents a sample of SmartScript code.

This code is entered in the Script_Finish statement of the ESS Form (SmartScript). It can be accessed from the Administration - SmartScript screen > Scripts view in the ERM application. For more information, see about Linking Self-Service Forms to the Inbox in Siebel Employee Relationship Management Administration Guide.

The purpose of the script is to take data from the ESS Form (SmartScript) as well as some required arguments to invoke the Universal Inbox business service under the Initialize method. When the user submits the ESS Form (SmartScript), 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 Script_Finish ()
{
var szScriptSessionId;
var szRequester;
var svc;
var indata;
var outdata;
var ssPage;
var ssQuestion;
var EmployeeLastName;
var EmployeeFirstName;
var RequestedChange;
var PAFComments;
var PAFPriority;
var szSSLanguageCode;
var szSSCurrencyCode;

ssPage = GetPage("PAF Which Change");
ssQuestion = ssPage.GetQuestion("Display Employee Last Name");

EmployeeLastName = ssQuestion.GetCurrentValue();
ssQuestion = ssPage.GetQuestion("Display Employee First Name");
EmployeeFirstName = ssQuestion.GetCurrentValue();
ssQuestion = ssPage.GetQuestion("PAF Change Requested");
RequestedChange = ssQuestion.GetCurrentValue();
ssQuestion = ssPage.GetQuestion("PAF Comments");
PAFComments = ssQuestion.GetCurrentValue();
ssQuestion = ssPage.GetQuestion("PAF Priority");
PAFPriority = ssQuestion.GetCurrentValue();

// Cancel saving everything to the database
Cancel ();

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

// Get the login name of the user
szRequester = TheApplication ().LoginName ();
// Get SmartScript Save Session table Id.
szScriptSessionId = GetSessionId ();

szSSLanguageCode = GetParameter("Language");
szSSCurrencyCode = GetParameter("Currency");

indata.SetProperty ("SmartScriptLanguageCode", szSSLanguageCode);

// ItemObjectId, ItemType, ItemSubmittedBy, and ItemDescription are the
// required input arguments for the "Universal Inbox.Initialize"
indata.SetProperty ("ItemObjectId", szScriptSessionId);
// Item Type is the Approvals Inbox type defined in the
// Approvals Inbox Administration screen
indata.SetProperty ("ItemType", "Personnel Action Form");
// Short Description of the inbox item
indata.SetProperty ("ItemDescription", RequestedChange + " PAF" + " for " + EmployeeFirstName + " " +
EmployeeLastName);
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", PAFPriority);
indata.SetProperty ("ItemComments", PAFComments);
svc = TheApplication ().GetService ("Universal Inbox");
svc.InvokeMethod("Initialize", indata, outdata);
}

Applications Administration Guide