Thursday, July 30, 2009

Limitation in "PRM ANI Utility Service" business service

I was working on one requirement which I was trying to implement using Workflow, where I need to perform the following :
a) Query on Account using EAI Siebel Adapter
b) Get the contact name for the very first child under the accounts.

requirement sounds very simple, same the case with me and I thought of using PRM ANI Utility Service to achieve the purpose with the help of just two steps in the workflow. So here is how these two steps looks like :

Process Properties:
Step1 : Query AccountBusiness Service : EAI Siebel Adapter
Business Service Method : Query
Step2 : Get Contact IdBusiness Service : PRM ANI Utility Service
Business Service Method : GetProperty

As per my expectation, I didn't get the "First Name" into process property "Name", but instead I was getting the error :

Error invoking service 'PRM ANI Utility Service', method 'GetProperty' at step 'Get Contact Id'.(SBL-BPR-00162)--Error Running Method 'Execute'.(SBL-PRM-00104)

I was getting crazy as not able to figure it out what exactly the root cause of it, but after some hit and trials it worked fine for me when there was only one single child record (Contact) under the Account for which I was querying. So let me tell you the reason why I was getting the error :



This is the snapshot from the watch window, where you can see there were actually 3 records under the accounts for which I was querying and due to this PRM ANI Utility Service was not able to figure it out for which record I need the First Name. So this is the limitation of this business service and you need to make sure while using "GetProperty" and "SetProperty" of this business service that there should not be more than one child in the propertyset.

I tried with querying for the Account having single Contact associated and it worked fine. So the only workaround is to write a customize business service if you want to get/set a property value of any child record.
Give it a try !!
.

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.

.

Friday, July 24, 2009

How to Pass arguments between Workflow & Customize Business Service?

Generally what happens is whenever we create any Customize Business Service, we rarely create "Methods" for it under "Siebel Tools -> Object Explorer-> Business Service -> Business Service Method". What we do is we directly start coding in "Service_PreInvokeMethod" like :
Today I am going to tell you how we can pass arguments of type "String" and "Hierarchy" in the call to Customized Business Service (which don't have any methods specified in "Business Service Method" also don't have any Input/Output arguments specified). If you have worked on the similar requirement earlier, you might be knowing the trick here but for the new people this might be useful.

Lets take the "String" arguments first :


Assuming a requirement to create a workflow where we need to call a customized business service which contains the complex logic and return back the Service Request's status. Please cosider this a requirement for an example here.

Input to Customized Business Service : Service Request Number
Output from Customized Business Service : Status

Here is the Workflow :

So, this seems very simple, right, whatever the "property name" I am setting in the Business Service, the same name should be used in the "Output Argument" of the step.

Lets see what extra need to do in case you are passing a Hierarchy as Input/Output arguments.

Workflow Requirement :
1. Query via EAI Siebel Adapter to get the SiebelMessage for Service Request Number.
2. Pass the Siebel Message as Input Argument to Customized Business Service to update something in it.
3. Get the updated Siebel Message as Output from Customized Business Service.
4. Update the Service Request via EAI Siebel Adapter.


Here is the workflow :


I think you need to try it out at your end to actually understand the trick here. Check it out !!

.