Monday, November 28, 2011

Hiding Custom Controls in Query Mode

"Yesterday it worked, Oops Today it is not working..."

This has to be my favourite line since i started my career. I was hit by the same nuke again by my team mate where we had to hide custom controls from the users in Query Mode. Some code was written to control the visibility of the custom buttons but it was failing in some conditions.

It is easy to control the above scenario when we have different applets for Edit and Query Mode. We can remove the custom button from the Query Applet and keep only on the Edit applet. However, things are little different in case we are using Edit List Mode. A custom code is viable solution but it is not full proof as there are chances that it may fail.
However Siebel comes again to our ally. For lucky developers who are working on SIA tools, there is a user property by which one can hide methods in Query Mode. 

Name: FINS Query Mode Disabled Method n
Value: Method Name 

The only catch here is the applet class should be "CSSFrameListFINApplication". So better test the entire functionality prior deployment.

Happy Configuration!!

Wednesday, November 23, 2011

Query within date range


Date range is one of the very common requirements across project. It eases out lot of tasks for end user, one can easily generate report or export data items within given date range. Recently we were asked to implement similar functionality by inputting From and To date from the end user and resulting in all Service Requests between the given date range. There could be multiple solutions to go about it but one potential one is detailed below.

1 - Create Two calculated fields in SR BC.FromDate and ToDate of type "DTYPE_DATE". Set the calculated value to "Today()".
2 - Expose these two fields in the Query mode of the Applet. In the Edit Mode hide these controls.
3 - Below piece of code is required for setting up the Search expression and clearing the specs on To Date and From Date.

var sFromDate = this.GetSearchSpec("FromDate");
var sToDate = this.GetSearchSpec("ToDate");
if(sFromDate != "" && sToDate != "")
{
 var sFrSubDate=sFromDate.substring(3,5)+"/"+sFromDate.substring(0,2)+"/"+sFromDate.substring(6,10);
var sToSubDate = sToDate.substring(3,5)+ "/" +sToDate.substring(0,2)+"/"+sToDate.substring(6,10);
var sSearchSpec = "[Created] >= '"+ sFrSubDate+ "' AND [Created] <= '"+ sToSubDate +"'";
this.ClearToQuery();
this.SetSearchExpr(sSearchSpec);
}

This code is generic enough without any error handling. Please add conditions as per your requirement. The basic catch here is we need to clear the FromDate and ToDate specs and build a new expression involving range and any other existing search criteria. Any dates used with SetSearchSpec must use the format
MM/DD/YYYY, regardless of the regional control panel settings of the server or client computer so the date variables should be modified to give proper result.

Happy Crunching!!


Monday, November 21, 2011

Session Management WebServices

This post is for one who has been bamboozled by below interview question.


Question: "Can we have dynamic users for Created By/Updated By fields during upsert operations instead of SADMIN in siebel inbound webservices using standard authentication mechanism? "
Soln: Yes we can, provided we are running a version 8.0.0.4 or higher. Stateless session management siebel authorization is key here in the inbound services.
Below setup is required in order to make this thing work.


1 - SessionAccessService and SiebelUserProfileService - These two webservices should be active and point to correct object manager. They should use sesssion management(i.e WSSOAP = 1) mode. The authentication type for all the methods should be set to None.

2 - Import wsdl and Consume SessionAccessService WS. Make a call to SessionAccess service and obtain the session token for a new Siebel User Session. For this PING method is used. The SessionToken value from the response message represents the unique Session Key that is associated with the newly authenticated and established connection for the SADMIN user. This token will be resused in subsequent requests. 

3 - Import wsdl and Consume SiebelUserProfileService WS. Using the session token obtained in previous step call method "SetContactContext" of the SiebelUserProfileService. In order to maintain context it is critical to pass SessionToken key. We should also pass the input argument "Login Id" of the user 
of which we want to set the context. "SetContactContext" method is added to "SiebelUserProfileService" business service as part of ACR - 385. 

4 - Now once the proper context has been established, upsert call to the desired entity should be made using the original SessionToken Key within the SOAP Header section. check the thin client for the magic as updated by will display the new user login instead of user used to login object manager. 

I hope it helps you make more comfortable when someone asks this question . 

Happy Integration!!






Tuesday, November 15, 2011

O.C.M. revised


Winter is approaching in this part of world, so is my hibernation mode. For a while Email templates are keeping me busy and some usage of "CreateRequest" and "SendMessage" methods of Outbound Communications Manager business service has forced me to draw a comparison between the two. It may help you to identify which one to go for sending outbound emails.

Below diagram lists out the advantages of both worlds.



There were situations where i felt need of passing parameters to email templates just as we pass parameters to DataMaps, DVM's at runtime. I searched for it without any success. Please feel free to comment if you have any clue about passing parameters to email templates apart from field substitutions or more points to add on above comparison list.


Happy E-mailing!!