Siebel Community

Welcome to Siebel Community. In this place you can find all the topics related to Siebel. This place is dedicated to provide information about how to implement Siebel CRM application. Siebel Technical/Functional consultants can get information from basics of Siebel CRM to advanced topics like EAI, EIM, eScripting, Workflows, Assignment Manager, Actuate Reports, Territory Management. This place also included Forums and Blogs to help you further.

Tuesday, November 15, 2011

Workflow Invocation

There are a number of ways that a workflow can be invoked using Siebel server script. This article will describe these alternatives and provide an example of each using Siebel eScript.


1. Call synchronous server request
2. Call asynchronous server request
3. Call workflow as a business service

1. Call synchronous server request
This method makes a request to invoke a task for the workflow to be invoked by the Workflow Process Manager Siebel component. When the request is made for the workflow to be executed, the script will wait for the workflow to completed prior to continuing (hence synchronous).
When the synchronous server request is submitted the request is routed to a siebel server which has the Workflow Process Manager component enabled and online. A new job/task is created for the workflow job, this task record will be displayed in the Administration - Server Management > Jobs view.
Using this method, the workflow will be invoked by the SADMIN user. This means that the any records modified by the workflow will show as modified/created by SADMIN.
Using this method, the workflow will be invoked on a server that has the Workflow Process Manager component enabled and online. This is a useful method in the case where the Siebel enterprise has a number of Siebel servers and a single Siebel server is dedicated to execute workflows. This may be handy if the workflow generates external files where it is important that these are always stored on the same server.
Here is an example of making a syncronous server request to call a workflow using Siebel eScript:
var svcServerRequest;
var psWorkflowChildIn;
var psWorkflowIn;
var psWorkflowOut;
try
{
svcServerRequest = TheApplication().GetService( "Synchronous Server Requests");
psWorkflowChildIn = TheApplication().NewPropertySet();
psWorkflowIn = TheApplication().NewPropertySet();
psWorkflowOut = TheApplication().NewPropertySet();
psWorkflowChildIn.SetProperty("ProcessName", "My Workflow Process");
with (psWorkflowIn) {
SetProperty("Component", "WfProcMgr");
AddChild(psWorkflowChildIn); }
svcServerRequest.InvokeMethod("SubmitRequest", psWorkflowIn, psWorkflowOut);
}catch(e){
TheApplication().RaiseErrorText(e.toString());
}finally
{ svcServerRequest = null;}


2. Call asynchronous server request
This method is the same as that for calling a synchronous server request, however after the call is made to execute the asynchronous server request, the script does not wait for the workflow to complete, it continues immediately and does not wait for the workflow.
Here is an example of making an asynchronous server request to call a workflow using Siebel eScript:
var svcServerRequest;
var psWorkflowChildIn;
var psWorkflowIn;
var psWorkflowOut;
try {
svcServerRequest = TheApplication().GetService( "Asynchronous Server Requests");
psWorkflowChildIn = TheApplication().NewPropertySet();
psWorkflowIn = TheApplication().NewPropertySet();
psWorkflowOut = TheApplication().NewPropertySet();
psWorkflowChildIn.SetProperty("ProcessName", "My Workflow Process");
with (psWorkflowIn) {
SetProperty("Component", "WfProcMgr");
AddChild(psWorkflowChildIn);
}
svcServerRequest.InvokeMethod("SubmitRequest", psWorkflowIn, psWorkflowOut);
}catch(e){
TheApplication().RaiseErrorText(e.toString());
}finally { svcServerRequest = null;}


3. Call workflow as a business service
This method executes the workflow in real time within the current application object manager instance. This method executes the workflow as though it was executing a business service.
Using this method, the workflow will always be executed syncronously. The workflow will be executed within the instance of the user session, therefore the workflow will be executed as the user logged in hence inheriting all the security settings of the user logged in.
Here is an example of calling a workflow as a business service within the application object manager instance using Siebel eScript:
var svcWorkflow;
var psWFInputs;
var psWFOutputs;
try {
svcWorkflow = TheApplication().GetService( "Workflow Process Manager");
psWFInputs = TheApplication().NewPropertySet();
psWFOutputs = TheApplication().NewPropertySet();
psWFInputs.SetProperty("ProcessName", "My Workflow Process");
svcWorkflow.InvokeMethod("RunProcess", psWFInputs, psWFOutputs);
}catch(e){
TheApplication().RaiseErrorText(e.toString());}
finally { svcWorkflow = null;}

No comments:

Post a Comment