Showing posts with label Siebel Business Service. Show all posts
Showing posts with label Siebel Business Service. Show all posts

Wednesday, 26 February 2014

Invoking a Siebel Business Service through a calculated field

If you are a siebel geek you know how powerful business services are.In my projects my most reliable object is Business service :-).In this post I will explain how you can invoke a business service through a calculated field.

Syntax

For the calculated field in the calculate value field create an expression as below
InvokeServiceMethod("Business Service Name", "Method", "'Input Argument'='Input Value'","Output Argument")

Using the above method the Business service is called for a method with arguments and value returned as output argument is assigned to the calculated field.

It is as simple as that and hope it helps sometimes.

Monday, 24 February 2014

Siebel escript to compare two dates

One of the common requirements that I came across multiple projects is to compare two dates and identify which date is greater than the other. I have created a function which can be reused. The function recieves two input dates d1 and d2 and will return 1 if d1 is greater than d2 else return 0

function CompareDates(d1,d2)
{
var date1 = new Date(d1);
var date2 = new Date(d2);
var date1Month = ToInteger(date1.getMonth()+1);
var date1Day = ToInteger(date1.getDate());
var date1Year = ToInteger(date1.getFullYear());
var date2Month = ToInteger(date2.getMonth()+1);
var date2Day = ToInteger(date2.getDate());
var date2Year = ToInteger(date2.getFullYear());
if ((date1Year < date2Year)||((date1Year==date2Year)&&(date1Month < date2Month))||((date1Year==date2Year)&&(date1Month==date2Month)&&(date1Day < date2Day)))
 return(0);
else
 return(1);
}

Refreshing an Applet in Siebel

I encountered an intersting requirement in one of my projects. One a button click parent child assoication should be removed for a record. I wrote script at Applet preinvoke event and in the script I cleared the link field and hence removed the parent child association. However the change did not reflect immediately in the UI for which I needed to refresh the current Applet and the solution that I found out from my guide(GOOGLE) was a vanilla business service FINS Teller UI Navigation and the method invoked is RefreshCurrentApplet.

var svcUI = TheApplication().GetService("FINS Teller UI Navigation");
var psIn = TheApplication().NewPropertySet();
var psOut = TheApplication().NewPropertySet();
svcUI.InvokeMethod("RefreshCurrentApplet",psIn,psOut);

Happy Scripting!!