1. Wrote script on write record event of BC to call workflow asynchronously.
2. Used Asynchronous Server Request business service to call the workflow.
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.
cheers..