Siebel Business Process Framework: Workflow Guide > About Workflow Process Design Options > Invoking a Workflow Process >

Invoking a Workflow Process Through Script


A workflow process can be invoked from a script using Siebel VB or Siebel eScript. By using a script, a workflow process can be invoked from anywhere in the Siebel application or from external programs.

When invoking a workflow process from script, you can specify that the process run 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.

Note that invoking a workflow process from script is performed in Synchronous mode.

Example of Invoking a Workflow Process from Script in the Object Manager

This topic gives one example of invoking a workflow process from script in object manager. You might use this feature differently, depending on your business model.

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 through 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 of Invoking a Workflow Process from Script to Pass Field Values to Process Properties

This topic gives one example of invoking a workflow process from script to pass field values to process properties. You might use this feature differently, depending on your business model.

The following script invokes a workflow process called My Opportunity Process. In this example, the workflow process is invoked in the object manager. 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);

Invoking a Workflow Process from Script Using the Server Requests Business Service

You can invoke a workflow process asynchronously from script by using the Server Requests business service. For more information, see Example of Using the Server Request Business Service to Invoke a Workflow From Script and Pass Values.

Siebel Business Process Framework: Workflow Guide Copyright © 2008, Oracle. All rights reserved.