Here is a good way to invoke a Workflow in asynchronous mode. (Workflow Policies are another option)
var bsSvc = null;
var psInput = null;
var psChild = null;
var psOutput = null;
bsSvc = TheApplication().GetService("Asynchronous Server Requests")
psInput = TheApplication().NewPropertySet();
psChild = TheApplication().NewPropertySet();
psOutput = TheApplication().NewPropertySet();
psInput.SetProperty("Component", "WfProcMgr");
psChild.SetProperty("ProcessName", "Health Plan Process"); //workflow name
psChild.SetProperty("Object Id", ContactId);
psChild.SetProperty("Policy Id", PolicyId);
psChild.SetProperty("OGType", "RatePlan");
psInput.AddChild(psChild);
bsSvc.InvokeMethod("SubmitRequest", psInput, psOutput);
No comments:
Post a Comment