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.)

Siebel Message Property Set

The Next buzz word that we hear in Siebel EAI is Siebel Message or IO Hierarchy. It appears to be very similar to XML hierarchy, but it is not!


Siebel Message or IO Hierarchy is an instance of an Integration Object in form of property set. It is mostly used in EAI workflows, but it can also be very useful in scripting and business processes.


What is Integration Object? : It is an structure that defines the Siebel Data that is needed to be integrated with Other applications.

An IO defines Business Object whose data will be integrated, BC whose fields will be updated, and the fields that will be used.


What is Integration Object Instance? :
When an Integration Object is used to query siebel database it results in an property set that contains the data in the structure represented in the Integration Object.
This output property set is called Siebel Message.

How Siebel Message is different from a Property Set?
Siebel Message is actually a property set whose type is set to "SiebelMessage".Most common method to create a Siebel Message is by calling Query Method of EAI Siebel Adapter Service.
This service creates the properties with Name specified in the Integration Components Fields.

On the other hand XML Hierarchy contains property name from the Integration Component XML Tag.

Mapping between Siebel Property Set and XML

I think first problem that we face in EAI is understanding the mapping between the Siebel Property Set and the XML. But once this mapping is clear Siebel EAI becomes lot more easier module to work on.



XML as we all know is the structured data trasfer language, and property set is set of variables contain values in form of string name value pairs. There are lots of vanilla services available in siebel tools that converts the property set in to an XML or write the property set to a file.


Let see how the property set is converted into an XML.
A Property set contains four parts which we can get and set by eScript methods.

Note : A property set can contain child elements , which can themselves be a Property Set, and can have Type , Property and a Value.

Similarly an XML contains:



Siebel converts
Type of property set to XML Element ,
Properties are added as Attrbutes,
Value is kept as Value of the Element
and child properties are added as child elements in XML.


This can be demonstrated by following code:


It will produce an XML output like this:





Workflow Revision Failed : SBL-DAT-00393: An end of file error has occurred.

Recently I faced a strange bug in my Siebel Tools. Whenever i tried to revise an workflow, i was getting this error :


An end of file error has occurred. Please continue or ask your system administrator to check your application configuration if the problem persists. (SBL-DAT-00393).

And after i press Ok button, tools hangs and every time i have to restart the tools.

Even when i tried to connect directly to the database server the error was re-occurring. And this was happening with a specific workflow only. I was very much bugged up at that time.

I searched support web but still couldn't find any reason behind this in Siebel Tools.

Then one of colleague suggested me to delete excess versions of workflows in tools to get it done.
At first i thought it wouldn't help, but yes it worked!!



I must say, Siebel has got mind of his own! Thanks to Manuj, who helped me to get this thing done.

Extending Column in Siebel : Video Tutorial

I haven't came across any siebel implementation till yet, that doesn't requires extension of siebel base tables. 

This usually required when siebel table doesn't have any column that can support the required data type or when there is additional data required at the business layer.

Although it can be achieved by using the extension table, but it is recommended that fields that are shown on UI or used frequently in the script should exists in the base column. 

This is because that extension column requires an additional join in the sql query. And every time BC based on the base table will be queried, extension table will also be called into the memory. 



Here is one video from you tube that explain the whole process of extending column as a screen cast.







Tom Siebel at Stanford University: Glory Days Long Gone for I.T.?

Here are some videos of Entrepreneurial Thought Leader Lecture at Standford University by Tom Siebel who started siebel systems and sold it to oracle.

Have a look what he has to say to new entrepreneurs @ stanford. 



Description
Tom Siebel, Chairman of First Virtual Group, paints a picture of the dramatic explosion of the dot-com boom; an era, he recalls, where "risk was a business problem, and not an anathema." With a 17 percent growth rate - an increase unprecedented before or since, says Siebel - the business opportunities of the 1980's era appeared to be unlimited. Changes in technology were total replacements, rather than incremental, meaning that every client had to buy and keep buying or find themselves lagging into obsolescence. He credits this free market flow with conjuring a revolution in computing and communications.


Description
Most of the promise of post-industrial society has been realized, says Tom Siebel, Chairman of First Virtual Group, and all of the great technological advances and development of great companies are behind us. The tech sector is hovering around a mere three percent annual growth rate, says Siebel; keeping it just on par with the rate of current economic growth.



Description
The globe's human population is currently around six-and-a-half billion, and it is slated to reach nine billion people in the next twenty years. Tom Siebel, Chairman of First Virtual Group, points out that this sharp increase will propel a worldwide demand for food, water, energy, and healthcare. And, he adds, the business opportunities in providing these essentials are unparalleled.



Description
Facing the likelihood of carbon reporting and carbon tracking that will be necessary with upcoming cap and trade legislation, Tom Siebel, First Virtual Group Chairman, announces a new initiative to help reduce the cost of reporting on an enterprise's carbon footprint - a tool that he foresees will serve a $3 trillion market in 2020.



Description
Forward-thinking entrepreneurs should consider government restrictions in their long-term business planning, says First Virtual Group's Chairman Tom Siebel. They should also be aware of the opportunities that exist through population growth and a growing demographic of the aged. And they should be thinking about solving the energy problem, and the provision of clean food and water for the planet.

Adding Button on Applet – Part 2

In part one of this post I have discussed how we can enable a button on applet and call workflow or service from it using scripting.
But Siebel user properties provides us the way to achieve the same behaviour without scripting. There are two or more solutions to it.


Solution 1 : Using CanInvokeMethod User Property
1. Create control on applet with method invoke property set to required method name.
2. Create an applet user property “CanInvokeMethod to activate this button conditionally.
3. Add an “NamedMethod” User Property on BusComp or Applet to invoke Business Service or Workflow of your choice.


Solution 2 : Using EventMethodMethodName User Property
1. Create Control applet with method invoke property as : EventMethodMethodName. Where Method Name is your orignal method.
2. Add “EventMethod Enabled” user property on Buscomp to conditionally activate the button.
3. Create a runtime event on PreInvoke of the Buscomp to invoke service or workflow.


Both of these solutions are suitable for our basic requirement of adding buttons on Siebel Applets. 

Please note that these user properties works on CSSBCBase BusComp class and CSSFrameListBase applet class. These are not defualt classes when you create new objects.

How to restrict length of an attribute - Part 2

In Continuation of my earlier post, for constraining the length of attribute, in this post i am explaining what other solution is available in out of the box Siebel application for this problem.
Attribute selected is an event which gets triggered before any attribute's value is updated, this events sends the information of the attribute and the value as property set argument.
XML representation of property set would look something like :
*from bookshelf

Now if this property set is available as argument then i think writing script to constrain its value is not a big task.

I have created this snippet, it worked in my case hope it works for others also.

function Cfg_AttributeSelected (SelectedAttribute)
{
 var temp = SelectedAttribute.GetChild(0);
 var sStr =  temp.GetProperty("NewVal");
 TheApplication().RaiseErrorText("Error");
}

Siebel Product Configurator: How to restrict attribute length?

Requirement
We have one requirement in our project, that we need to restrict the value of one attribute to five characters only.

In Siebel vanilla application we tried to implement this without doing scripting, but failed.

Solution we used:
This requirement can be achieved in two ways:

1. By Scripting in Attribute Selected event. update or 
2. Creating Custom User Properties for product configurator.

I will be discussing the second solution in this post. It will involve editing of cfgui.js . For more info my older posts 

1. Find the following code in cfgui file.


try to find text: function showtextbox.
Updated Section:
2. Replace the code with :


3. Create user property on the root product like:



and you are done!

Now clear cache of browser and restart the client.

Attribute on which you have defined the property will automatically be constrained by the number of characters that you have provided in property.


Hope its is understandable.

For more info how it worked, look at the maxlength property here.

Read only Siebel Product Configurator.

Requirement:
Requirement is to make the Configurator session read only conditionally, so that user should not be able to edit the product configuration but he should be able to view the configuration inside the configurator.

Solution
This requirement can be implemented by editing vanilla/custom JavaScript libraries of the Product Configurator. The most of the work in showing the UI is done by cfgui.jsfile.

Cfgui.js is a javascript library that converts the swe tags to the HTML tags that shows up as UI in siebel application.

For Example:

Here is one code in the swe template :
< id="swe:IncPAId+853" cfgfieldname="AttValue" cfghtmltype="CfgTextBox" forcerefresh="Y" cfgjsshow="showTextBox" cfgjsupdateselection="updateSelectionInfoForAttribute" >


now in cfgui this swe code is converted in to HTML like this:

innerHTML = " < input type=\"teext\" " + "value=\"" + displayValue + "\" " + "id=\"GRPITEM" + _pipe + grpItemId + _underscore + "ATTTYPE" + _pipe + "TEXT" +"\"" + " onchange='processInput(\"GRPITEM" + _pipe + grpItemId + _underscore + "ATTTYPE" + _pipe + "TEXT" +"\", \"\", \"text\")' />";

now when you closely go through the code, you will create the following string at the output:

< type="”text”" value="”Somevalue" id="”generated" onchange="”processInput(“Some arguments") >


and that looks like very basic html snipet, which can be edited to make control read only by adding disabled=true in the js code tag.

To make it work conditionally, we can check for the some profile attribute inside the js file like this:

var readonly = top.theApplication().GetProfileAttr("ReadOnly");
top.theApplication().SetProfileAttr("ReadOnly","N");

if (readOnly == "Y")
innerHTML = "";

else
innerHTML = "";

Siebel: Adding Button on Applet - Part 1

This is one of the basic thing that we do in our siebel application. And every developer prefer his own way of configuring it.

From my past experience there are two basic requirement for custom buttons :
1. It should invoke a Workflow or Business Service.
2. It should become Active/Inactive  based on certain condition.

Based on these requirements first solution that come to our mind is with a script in Pre_CanInvoke of applet, but there are lot more options available in Siebel for this requirement.

First lets see how a scripting can solve this problem

Solution1: Scripting Applet and BC
1. Create Control in Form or List Applet, Set its method invoke to name of the method.
2. Place it on the web layout of applet.
3. Write following script on applet pre can invoke event:



4. Write the actual code to call service or workflow in Applet pre invoke or BusComp PreInvoke.


This trick work always irrespective of the application or interactivity of the application or the applet type.

But there are options available in Siebel that can be used to  achieve this functionality without use of scripting. We will examine other options in my next post!

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);

Clib.fclose(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.


Other Siebel Blogs

siebel-admin-l @ IT - toolbox

siebel-dev-l @ IT - toolbox