Thursday, July 30, 2009

How to call "Asynchronous Server Requests" business Service?

Sometimes there is a requirement we need to run few processes that should not stop the user on the screen to go further and do next steps when Siebel is processing something in the background. That is the place when Asychronous processes come into the picture and the solution that Siebel provides for these kind of scenarios is to give a call to "Asynchronous Server Requests" business service.

There are only two ways (that I know my past experience, please add if anyone know more) by which you can call "Asychronous Server Requests" Business Service :

a) Via e-Script : easy way to do that and most people know this.
b) Via Workflow : this is bit tricky
Lets see each one of them in detail. Taken an assumption that you need to invoke a workflow (asynchronously). Assume the workflow name is "Send Email Opportunity Sales Rep", which just sends an email to the Sales Person on the Opportunity and the Input Agrument to the workflow is : "OpptyId" (1-XR45)

Via e-Script :
Here is the piece of code that you can to achieve the above requirement :
var svc = TheApplication().GetService("Asynchronous Server Requests")
var input = TheApplication().NewPropertySet();
var child = TheApplication().NewPropertySet();
var output = TheApplication().NewPropertySet();
input.SetProperty("Component", "WfProcMgr");
child.SetProperty("ProcessName", "Send Email Opportunity Sales Rep");
child.SetProperty("OpptyId", "1-XR45");
input.AddChild(child);
svc.InvokeMethod("SubmitRequest", input, output);
very simple, isn't it. We just need to make sure that the Input Argument of the calling Workflow (Send Email Opportunity Sales Rep) should be the properties of the Child Property Set.

Via Workflow :
Here is the example below in which I have used this and you can accomodate the below two steps in any of the workflow you are using :

Process Properties :
Name : Inputs
Type : Hierarchy

Step1: Set Input Arguments
Business Service : Workflow Utilities
Business Service Method : echo


Step2: Call Asynchronous Service
Business Service : Asynchronous Server Requests
Business Service Method : SubmitRequest


Thats it, you are done. Just to add it here, I tried doing the same stuff with the help of runtime events but it is limitation there and we cannot do that.

.

16 comments:

  1. I never knew, Workflow Utilities echo is so useful to create Child propery set.... Thanks for posting !!

    ReplyDelete
  2. Gaurav, can you explain how this request will be processed on the server? As we are not specifying any parameter for scedule start or start time as done in case of Jobs.

    Which component will complete this request? If it is SRProc, then what will be the process type Scheduled Asynchronous Request or Asynchronous Request??

    ReplyDelete
  3. Tejeshwar,

    We don't need to specify the start time if you want to start the job asynchronously immediately and it is the same thing you do while creating a new Job under "Administration-Server Management -> Jobs" view and "Scheduled Start" automatically get populated with the current sysdate. So after invoking the above mentioned code, if you go to "Jobs" view you will see the system has populated the sysdate automatically.

    I have used the Component as "WfProcMgr", so this request being processed by "Workflow Manager" component and subsequently by SRProc, as Workflow Manager reply on SRProc to process its requests. I am not sure about the process type what it would be in this case. May be people who have more insight can put their thoughts here.

    But one thing I can assure you is that everything would be the same as it would be when you create an Asynchronous server request from the UI (Admin-Server Management -> Jobs view).

    --Gaurav

    ReplyDelete
  4. Great info, I have tried it now, it works great! I was concerned about tracking of such requests.

    Now i have seen it, it creates new server job that are visible in server management screen.

    gud work..keep it up!

    ReplyDelete
  5. Gaurav, I would like to know the "Mode" in which the workflow gets executed if I call it using "Asynchronous Server Requests" Business Service. Is it "DirectDb" by default? Is it possible to specify a different mode.

    Great work.. Keep it up!!!

    ReplyDelete
  6. Hi Lokesh, the mode would be "DirectDb" and it is not possible to specify the mode if you use "Asynchronous Server Requests". But you can specify mode of execution if you use "Server Requests" business service. Please refer:
    http://download.oracle.com/docs/cd/B40099_02/books/BPFWorkflow/BPFWorkflow_Reference4.html

    --Gaurav

    ReplyDelete
  7. Asynchronous Server Requests maps to the Schedule mode of the new Server Requests business service. It is not same as DirectDB

    Asynchronous Server Requests is siebel 6.0 version and is not recommended. Use "Server Requests" with mode = DirectDB for stable and predictable behaviour

    ReplyDelete
  8. Gaurav,
    Your example showed how to invoke a WF. Can you show one for invoking a business service? I peruse the doc for Server Request Business Service and it requires that a component name be supplied and I'm not sure what would be the component name for a business service, is it the callcenter_enu for example?
    Thanks in advance for your reply.

    ReplyDelete
  9. How can we pass a row set as a child to the inputs property set

    ReplyDelete
  10. Hi,

    Can we pass a heirarchy as a child to Inputs. Thanks in advance

    ReplyDelete
  11. Hi Anonymous,

    Yes, you can. Please refer the below post:
    http://siebelmantra.blogspot.com/2009/07/how-to-pass-arguments-between-workflow.html

    Cheers
    Gaurav

    ReplyDelete
  12. Hi Gaurav,
    When server requests business service serves our purpose what is the need to go for Asynchronous server request Business service, can u pls tell me the major differences between these 2 BS.

    ReplyDelete
  13. Hi Anonymous,

    I have already mentioned the difference in the first paragraph of this post, please refer again:

    "Sometimes there is a requirement we need to run few processes that should not stop the user on the screen to go further and do next steps when Siebel is processing something in the background. That is the place when Asychronous processes come into the picture and the solution that Siebel provides for these kind of scenarios is to give a call to "Asynchronous Server Requests" business service."

    Cheers
    Gaurav

    ReplyDelete
  14. Hi All,

    My requirement is to by click on 'activate' button, it needs to submit a RCR with Workflow Process Batch Manager; the job needs to have two parameters: 1. Workflow Process Name 2. Search Specification.

    The job needs to run once in a day (the start time will be the time when 'activate' button is clicked)

    The search specification is formed from the applet record where the 'activate' button is available.

    I have tried to pass the search specification as input arguments as per the above example, however the search specification does not created in the job. And it is a one time execution as explained.

    Could you please assist on how to submit a RCR through workflow and how to pass the input arguments like search spec, repetitive, repetitive Unit, etc to 'Asynchronous Server Request' Business Service?

    ReplyDelete
  15. Job created in Admin - server management is having status as Queued only.

    Please help me out.

    Thanks and regards

    ReplyDelete
  16. Hi Gaurav,

    In one of the WF i am passing StartDate to trigger the second wf, but the second wf triggers even before the startdate value. Can you suggest something.

    Regards,
    Pallavi

    ReplyDelete