Showing posts with label Siebel eScript. Show all posts
Showing posts with label Siebel eScript. Show all posts

Sending email from eScript

Sending email updates from Siebel is quite easy, we just have to call Outbound Communication Manager, an OOB Business Service to trigger emails.

Get Attribute Value - Product Configurator

There is no method out of the box available in Siebel Product Configurator that can be used to get attribute value. For this one of my team member have written this code which traverses the product structure and return the attribute value as string.

Debugging Siebel eScript - Write Property Set to file

This is one of the tricks that i use to debug Siebel scripts. It is really useful if you are working on the product configurator. As most of the events in configurator have property set as argument to it, and there is no debug window to see runtime property values for the events.

Date functions in Siebel eScript

If you have worked on any date field then you would be knowing that some of the standard date functions are not available in Siebel escript, like converting date from one format to another, adding number of business days to a particular date, comparing two dates etc.,

Here are some methods built in eScript that perform these operations.

Case Insensitive Query in Siebel by using LIKE operator !

I think most of the readers would know how to perform an case insensitive search/query in Siebel. Those who don't read on!

Case insensitive query in Siebel means to query the database records using the LIKE operator in SQL. This type of SQL tends to be slow as they return more records than the equal (=) operator.

How to generate random number in Siebel eScript?

Recently I had a requirement to generate non-repetitive random numbers in siebel escript. I searched the siebel tools help and found Clib.rand() function to the rescue. And using it was also very simple.

Accessing Field in Siebel Browser Script

Accessing a field in browser script can a bit pain, for someone who is new to the browser scripting. There is no direct way to access the field in browser scripts that are not shown on the applet at run time.

This is because the browser script works on the DOM elements not the Siebel Objects. Siebel to support its syntax, publishes some of the objects and methods in the browser script.

There is a workaround to access field in the browser script:
1. Add a control in the applet with the required field.
2. Set the HTML Type of control to Hidden.
3. Add this control on the list applet as column or on the header (where buttons are placed) of the form applet.
4. Create usual script to GetFieldValue. Now you will be able to get the value inside the script.

There are also lots of restriction in the browser script as compared to Server Script, some of them being:
  • TheApplication() in eScript is converted to theApplication() in JavaScript.
  • We can not use theApplication().GetBusObject(), can only use theApplication().ActiveBusObject();
  • Cannot Get and Set Field values that are not shown on the UI.
  • Cannot use InvokeMethod("LookupValue") (this creates lots of troubles in developing multilingual prompts.)

Debugging Siebel - Creatng custom logs using Clib.fputs

When it comes to debugging Siebel application, no one beats the Siebel vanilla logs (events logs governed by environmental variables), but every developer use his own techniques to debug his configuration.

In this post I am discussing the way I debug my things.

I add following piece of code at every event that I want to monitor, and add my required parameters to it, and then just compile all the objects and run the scenario.

var date = new Date();

var fp = Clib.fopen("d:\\log.txt","a");

Clib.fputs("\n" + " BCPreInvokeMethod" + " " + date,fp);


In above code first line creates a date object that give the timestamp that will be written in the log file. Second line creates a file pointer that opens file/creates file in write mode. In next line Clib.fputs function writes string to the file.

We can now simply alter string according to our requirement, and get the exact output.

This way i get exact view of events and parameters in a flat file, that makes it really easy to understand the actual problem. If you are trying this code then you will get output something like :

PreInvokeMethod SetAspectSun Aug 02 2009 01:52:19

PreInvokeMethod SetAspectSun Aug 02 2009 01:52:19

PreInvokeMethod SetDefaultDurationSun Aug 02 2009 01:52:19

PreCanInvokeMethod DeleteRecordSun Aug 02 2009 01:52:19

PreCanInvokeMethod ShowQueryAssistantSun Aug 02 2009 01:52:19

PreCanInvokeMethod ToggleListRowCountSun Aug 02 2009 01:52:19

PreCanInvokeMethod ExecuteQuerySun Aug 02 2009 01:52:19

PreCanInvokeMethod GotoNextSetSun Aug 02 2009 01:52:19

PreCanInvokeMethod GotoPreviousSetSun Aug 02 2009 01:52:19

PreCanInvokeMethod NewQuerySun Aug 02 2009 01:52:19

PreCanInvokeMethod NewRecordSun Aug 02 2009 01:52:19

PreCanInvokeMethod PositionOnRowSun Aug 02 2009 01:52:19

PreCanInvokeMethod UndoQuerySun Aug 02 2009 01:52:19

PreCanInvokeMethod UndoRecordSun Aug 02 2009 01:52:19

PreCanInvokeMethod WriteRecordSun Aug 02 2009 01:52:19

PreCanInvokeMethod ShowPopupSun Aug 02 2009 01:52:19

PreCanInvokeMethod GetBookmarkURLSun Aug 02 2009 01:52:19

PreCanInvokeMethod FileSendMailSun Aug 02 2009 01:52:19

PreCanInvokeMethod FileSendFaxSun Aug 02 2009 01:52:19

PreCanInvokeMethod FileSendPageSun Aug 02 2009 01:52:19

It can be really helpful if you working on a new siebel application and doesn't know how things work.

Although it takes longer time to get the output, but it really helps when all other options fails.

How to use output of Business Service Simulator?

If you have ever developed business services and workflows you must have definitely gone to Business Service Simulator View, to test or simulate business services or workflows.

But have you ever wondered that can we use the output arguments of the simulation again as input to the next simulation?! Even i didn't really thought about this earlier, until in Acceptance test of our project i needed to reproduce the behavior of one my workflow in controlled manner.

At that time one of my colleague suggested me to use Move to Input in built functionality of the Siebel Business Service Simulator.

Lets see how it is done:

1. Go to Administration Business Service Screen and Simulate the first service.

In my case I first simulated EAI Siebel Adapter Service Query Method to generate Siebel message..

2. You will then see a record created in the grandchild Applet containing the output properties of the business service. Now if you want to use this output as input to another business service then there is one way to copy and paste value into the input or to use Move to Input button!!!

This button copies the output property set record to the input, and then these can be used to simulate another business service.see screenshot:

This is becomes very useful if our service is expecting derived inputs. By use of this we can simulate certain steps of workflow on the run.

Please let me know if it helps anyone. :)

Other Siebel Blogs

siebel-admin-l @ IT - toolbox

siebel-dev-l @ IT - toolbox