Runtime Events Workflows – Part 2

Click Here to Goto Part 1 of this Article

This Article is about Siebel CRM 7.X Workflows and Runtime Events. It tells you how can we use them to our advantange.

In this article I will tell you about the actual process of Setting up Runtime Event and Business Service assuming you have working knowledge of both. If you want to know the basics of these please see other posts of my blog.

Just one important thing that you should know about runtime evetns is that they are executed even before the Business Component Events. To explain it better I am taking an example where our requirement is to execute a workflow when you click Submit Oppty button on Opportunity Form Applet.

  1. Goto Administration ==>Runtime Events Screen
  2. Goto Action Sets View
  3. Create a New Record in the Action Set View of Runtime Events Administration Screen
  4. Enter Any Name in the Name Field of the Action Set List Applet
  5. Create New Record List Applet Below it
  6. Enter

Name = “TestRuntimeEvent” ;
Action Type = “Business Service” ;
Sequence = “1”

  1. In the Form Applet Below Enter the Following Details Business Service = “TestBS” ; Business Service Method = “TestMethod”8. Click Menu ==> Reload Runtime Events Make Sure that you have Active Flag checked in both List Applets.

You are done in Action Set View.

Now Goto Events view and Follow the steps given below

  1. Click New and Enter the Following Information

Sequence = 1 ;
Object Type = “Applet” ;
Object Name = “Opportnity Form Applet” ;
Event = “InvokeMethod” ;
Sub Event = “Submit Oppty” ;
Action Set = “TestRunTimeEvent”

Conditional Expression should be given if you want the restrict the execution of this Runtime Event to certain conditions and Action Set Name is always the name of the action set that we created.

2. Click Menu ==> Reload Runtime Events.

Now we are going to write the code in the busines service which will actually result in the execution of Workflow Process Asynchronously.

  1. Go To Administration ==> Business Service
  2. Create a Business Record with name “TestBS”
  3. Create a Record in List Applet for Service_PreInvokeMethod and choose Programming Langauge as “eScript”

Write the Following code in Code Window inside the function Service_PreInvokeMethod

if(MethodName == “TestMethod”)
{
var svc;
var child;
var input;
var output;
var rowid;
var bo = TheApplication().ActiveBusObject();
var bc = bo.GetBusComp(“Opportunity”); // Change the BusComp name with the name of the BusComp you want to execute the workflow with
svc = TheApplication().GetService(“Asynchronous Server Requests”); // Don’t change this – Actual BS that is responsible for submitting a job to WPM
input = TheApplication().NewPropertySet();
child = TheApplication().NewPropertySet();
output = TheApplication().NewPropertySet();
input.SetProperty(“Component”, “WfProcMgr”);
rowid = bc.GetFieldValue(“Id”);
// We would like to pass the row id of the Current record on which the user is working – You can pass more than one arguments
child.SetProperty(“ProcessName”, “Service Agreement – Agreement Status”); // Workflow process you want to execute
child.SetProperty(“RowId”, rowid); // passing the values
input.AddChild(child);
svc.InvokeMethod(“SubmitRequest”, input, output); /// invoking the business service method
svc = null; // nullfiying the objects
child = null;
output = null;
input = null;
return(CancelOperation);
}
And you are done!!!!!!!!!
Please post your comments if this post helps you in anyway.

Click Here to Goto Part 1 of this Article

This Post has been viewed : 36,984 Times


12 Responses to Runtime Events Workflows – Part 2

  1. Hi Neel, I tried this one but doesn’t work.
    In the above example you didn’t mention anything about the “Submit” button script at applet level. don’t we need to add the applet code to activate it.. or runtime events take care of it?
    also.. what is the server component that takes care of the “Asynchronous Server Requests”. when I checked I didn’t find any of that kind in my components..
    pls clarify.
    thanks.
    chandra.

  2. Hi Neel, I tried this one but doesn’t work.
    In the above example you didn’t mention anything about the “Submit” button script at applet level. don’t we need to add the applet code to activate it.. or runtime events take care of it?
    also.. what is the server component that takes care of the “Asynchronous Server Requests”. when I checked I didn’t find any of that kind in my components..
    pls clarify.
    thanks.
    chandra.

  3. Why can't we set Processing mode property of Start step to “Remote Asynchronous” for making the WF a Asynchronous one?

  4. This process is way to lengthy and can be made shorter by directly using the WfProcMgr in the Runtime Events.

Leave a Reply

Contribute