Siebel Business Process Designer Administration Guide for Financial Services > Running Workflow Processes > Invoking a Workflow Process >

Invoking From a Script


Workflow processes can be invoked programatically from a script using Siebel VB or Siebel eScript. By using scripts, workflow processes can be invoked from anywhere in the Siebel application or from external programs.

When invoking a process from a script, you can specify that the process run either on the server or in the object manager. To run a process on the server, call the service Workflow Process Manager (Server Request). To run a process in the application object manager, call the service Workflow Process Manager.

Example: Invoking Process in Object Manager

The following is a sample script that invokes a workflow process called My Account Process. In this example, the process is invoked in the object manager.

// Example: Invoking a Workflow Process via scripting
function Invoke_Process()
{
var svc = TheApplication().GetService("Workflow Process Manager");
var Input = TheApplication().NewPropertySet();
var Output = TheApplication().NewPropertySet();
var bo = TheApplication().ActiveBusObject();
var bc = bo.GetBusComp("Account");
var rowId = bc.GetFieldValue("Id");

Input.SetProperty("ProcessName", "My Account Process");
Input.SetProperty("Object Id", rowId);

svc.InvokeMethod("RunProcess", Input, Output);
}

Example: Passing Field Values to Process Properties

The following is a similar example script that invokes a workflow process called My Opportunity Process. In this example, the process is invoked in the object manager and additional field values are passed to process properties defined in the workflow process.

//Example: Passing Field Values to Process Properties
function Invoke_Process()
{
   var svc = TheApplication().GetService("Workflow Process Manager");
   var Input = TheApplication().NewPropertySet();
   var Output = TheApplication().NewPropertySet();
   var bo = TheApplication().ActiveBusObject();
   var bc = bo.GetBusComp("Opportunity");
   
   var rowId = bc.GetFieldValue("Id");
   var accountId = bc.GetFieldValue("Account Id");
   
   input.SetProperty("ProcessName", "My Opportunity Process");
   input.SetProperty("Object Id", rowId);
   
   // Pass the value of the Account Id field to the Account Id process property
   Input.SetProperty("Account Id", accountId);
   
   svc.InvokeMethod("RunProcess", Input, Output);


 Siebel Business Process Designer Administration Guide for Financial Services 
 Published: 22 May 2003