Friday 29 May 2015

Executing a workflow asynchronously . .

Hi all, while using siebel workflow i had a requirement where i need to call a workflow asynchronously. The exact requirement was to capture some login user information and add the information in other table but this was to be done so that the performance was not degraded  since the first approach we were using was based on calling a workflow in the write event of BC  but this was taking time as the execution was synchronous so we used the following approach.

1. Wrote script on write record event of BC to call workflow asynchronously.
2. Used Asynchronous Server Request business service to call the workflow.

Sample script looked like

var svc;
var child;
var input;
var output;
var rowid;
var bo = TheApplication().ActiveBusObject();
var bc = bo.GetBusComp("Opportunity");
svc = TheApplication().GetService("Asynchronous Server Requests");
input = TheApplication().NewPropertySet();
child = TheApplication().NewPropertySet();
output = TheApplication().NewPropertySet();
input.SetProperty("Component", "WfProcMgr");
rowid = bc.GetFieldValue("Id");
child.SetProperty("ProcessName", "HW Device Tracking Workflow");
child.SetProperty("RowId", rowid);
input.AddChild(child);
svc.InvokeMethod("SubmitRequest", input, output);


Note: please refer bookshelf for the exact syntax 

the advantage of calling WF asynchronously is that the control is returned to the main process instantly after submitting the request and it does not wait for the execution of the workflow, the request is submitted on the server and is executed in background.

this process can also be done without using scripting by calling a workflow using Run Time Event on BC event and define the process of calling workflow asynchronously in the created workflow. 
for more details about Synchronous workflow execution please refer the following link


 cheers..

No comments:

Post a Comment

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...