Tuesday, September 28, 2010

Generating unique numbers in DataMap

Sometimes data coming in inbound integration from external system cannot be uniquely identified.Similar scenario struck me and was forced to generate unique number at siebel side. One of the option was to parse incoming XML and add unique identifier using Scripting or XSL. Another option was to use "SIS OM PC Service" business service in datamaps and the generated output row_id could be used as user key during the insertion. In the field map following expression is used:
InvokeServiceMethod("SIS OM PC Service", "Get Next RowId","Test='123'" ,"RowId")

However the enigma was not ended here. Further twist was error "Access denied to invoke business service 'SIS OM PC Service' for search specification 'InvokeServiceMethod("SIS OM PC Service", "Get Next RowId","Test='123'" ,"RowId")'" . After some hunting on the support web i realised this security issue. In order to use any business service with InvokeMethod we need to define that business service at following places:

1 - Mobile Web client/Dedicated client: In CFG we need to define following parameter
[Siebel]
BusinessServiceQueryAccessList = SIS OM PC Service

2 - Web Client: We need to define this in Parameter "Business Service Query Access" at enterprise or component level where it is being used.
Name:Business Service Query Access
Value:SIS OM PC Service

Help in need is help indeed thus any help on generation of unique numbers in siebel during inbound are really welcome.

Sunday, September 19, 2010

FINS Data Transfer Utilities

The best thing while working on siebel is you are never short of options. Recently we had requirement of updating a Service request from contact. Finally we did that using "EAI Siebel Adapter" business service. However during that time i came across another business service "FINS Data Transfer Utilities" popularly known as DTU business service. As i was not having prior knowledge of it going by the rule of not learning swimming lessons while drowning i decided not to go for it. Lately i have tried to explore this service and trust me it can do wonders.

Here is a sample example update of Service Request from contact. We need to follow below steps in order to understand strength of this business service.

1 - Navigate to Site Map. Go to Administration - Application -> Data Map Administration tab. Create a new Record with following options:

Name: Service Request Test
Source Business Object: Contact
Destination Business Object: Service Request

Here the source business object specifies where data should come and Destination busobject specifies where data should go.

2 -In Data Map Component we specify mapping of the child business component. There needs to be one root business component and other child business component in the map. This is really handy while creating quotes and quote line items from Opportunity. Or any other instance where multiple BC's are under scanner.

Name: SR Update
Source Business Component: Contact
Destination Business Component: Service Request



3 - In Data Map field we specify field to field mapping, data from which source field should go to which destination field. However source/destination field could be of following types based
on our requirement:

Field: BC field
Parameter: Input argument to business service
Expression: combination of BC field or Parameters

The most important thing here is the Key field, which helps in matching source record with destination record during update operation. More of this is given in "siebel finance bookshelf".



4 - Once data map is done, our job is very simple. We need to write a workflow which can call this business service and invoke that workflow on contact write
record. Sample workflow should look like.

Method Invoked is: DataTransfer

Parameters which we have passed are:

Operation - Update : It specifies which operation we need to perform. Values are Insert,Update,Delete and Upsert
InitBO - Contact : Initiator BO
InitBC - Contact : Initiator BC
DataMapObj - Service Request Test : Name of the Data Map
&Status - Closed : Status value we need to set for SR
&SRId - '288-70710' : SR Number for which we need to set status. This could be process property. I have hard coded for testing purpose.


5 - Create a runtime event which invokes this workflow on writerecord of Contact BC. Once reload is done try to see the magic.
This business service is of immense help if used efficiently and can be of real help in scenarios involving update/insert of multiple business components.

Learning Swimming and Siebel.

Monday, September 13, 2010

Auto-Refresh/Auto-Save

I am pretty sure most of us here are sports buff. Me being an ardent cricket lover used to spend 4-5 hours on cricinfo. Life is really cool when the scoreboard says the latest score automatically in every 2 minutes. It would have been real killing if someone had to manually click on refresh button to get the latest updates or for money matters latest update on stocks every n minute.

One of my friend recently experienced same problem while dealing with service requests. The scenario was to have auto refresh of the SR list applet pool in every 2 minutes so that users can pick request to work on, as requests were coming from some other portal. Once again support web was our alley. A little bit of browser script and deal was done. Following steps were taken to achieve this:

1 - Query applet for which auto-refresh is required. Open Browser Script editor. Jump on the Applet_Load event and put below script:

function Applet_Load ()
{
//To Invoke AutoRefresh function in every 2 minutes
setTimeout("AutoRefresh()", 120000);
}

2 - Create a function "AutoRefresh()" in the general section of applet with following code:

function AutoRefresh()
{
var sApplet = theApplication().FindApplet("Service Request List Applet");
sApplet.InvokeMethod("ExecuteQuery"); // this is used to refresh current applet
// condition that ensures that it happens in the desired view only, if applet is being used in other views
if(theApplication().GetProfileAttr("ActiveViewName") == "Personal Service Request List View")
{
setTimeout("AutoRefresh()", 120000); // this is to invoke the above function recursively
}
}

Similarly Auto-Save functionality could be achieved by using following function:

function AutoSave()
{
var sApplet = theApplication().FindApplet("Service Request List Applet");
sApplet.InvokeMethod("WriteRecord"); // this is used to write Record
setTimeout("AutoSave()", 120000); // this is to invoke the above function recursively
}

The main crux here is standard javascript function which takes two input parameters.

setTimeout(String(Function name), Number(Delay))

Function name - Name of the function to be executed
Delay - Number representing delay in milliseconds before the specified function will be called.

The same could be achieved by having a button on the List applet but then why to go for beans when you can have Cake.


Tuesday, September 7, 2010

Batch Processing

Batch processing is integral part of any development and is must in cases involving escalations,auto-assignments or bulk emailing. Siebel provides multiple ways to do batch processing but one to choose depends on the requirment at hand. Lets consider an escalation scenario which involves SR reassignment to Manager when commit time is reached if it is not closed. The two possible approaches to achieve this are:

1 - Workflow Policies with Batch Mode set to True
2 -Workflow Process Batch Manager component

It can be real dilemma which one to use as they say "you always have choice of selecting action but not the consequence". Both approaches have its own advantages. Lets discuss each of them.

Workflow Policy with Batch Mode

1 - Create a Workflow Policy as following based on "Service Request" object with condition

Status <> Closed
Commit time >= Current

Set the batch mode to True. Specify the action which will run the workflow to reassign SR.

2 - We need to schedule a task on server to execute a batch file or script which executes server manager command lines to execute workmon to run in batch
mode.

Workflow Process Batch Manager

1- Create a Repeating Job for component WorkflowProcess Batch Manager.

2 - Set the SearSpec parameter to "[Status] <> Closed AND [Commit Time] >= Today()"

3 - Set the Workflow Process name to the desired workflow which is used to reassign SR

Technically either of them could be used to perform the desired escalation but me inherently being an follower of KISS(Keep it Short and Simple) principle will go for second option as it is easy to manage Workflow Process batch manager Job as compared to the batch Policies. However, if we have to execute a sequence of action apart from run process then batch workflow policies should be considered. Batch workflow policies are also quite handy in sending consolidated email for multiple requests.

Please feel free to put your thoughts across which one should be used for the cause.