I recently designed some functionality for a Prison department, and i unwittingly named from one my functions Escape. This raised alarm bells in the system, and a couple of men in black, escorted me to an interview room.

I was questioned whether i put some back door functionality to allow unlawfuls to escape. Luckily, the following explanation got me out of jail (The MIB must of known some Siebel).

The functionality that i was building required me to look up a code, and get back the related description. The concept can be seen from the following example.
function Lookup(sType,sValue) {
var sDesc = "";
var oBO = TheApplication().GetBusObject("PickList Generic");
var oBC = oBO.GetBusComp("PickList Generic");


oBC.SetSearchSpec("Type", sType);
oBC.SetSearchSpec("Value", sValue);
oBC.SetSearchSpec("Active", "Y");

if (oBC.FirstRecord())
sDesc = oBC.GetFieldValue("Description");
return sDesc;

However the lookup value that i was using contained special key words and values which caused my query to fail.

[Fail Scenarios]
var sValue = "Thomas and Dieter";
var sValue = "Thomas or Dieter";
var sValue = "Dieter's the one with dimples";


To understand whats happening, lets have a look at how Siebel generates the SQL
var sValue = "Thomas and Dieter";

SearchSpec: [Type] = "MY_TYPE" AND [Value] = "Thomas" AND [Value] = "Dieter"

Siebel interprets "Thomas" and "Dieter" as two separate conditions and applies the "AND" operator

var sValue = "Thomas or Dieter";

SearchSpec: [Type] = "MY_TYPE" AND ([Value] = "Thomas" OR [Value] = "Dieter")

In this case, Siebel predictably, takes "Thomas" and "Dieter" and applies the "OR" operator

var sValue = "Dieter's the one with dimples";//Error

This will fail.

I would expect this behaviour for SetSearchExpr, but not SetSearchSpec.


To correct this behaviour, we need to escape our search specs.

Heres how we do it.
function Escape(v)
return "'" + v.replace(/'/g, "''") + "'";

The above function escapes any single quotes in the expression, wraps the entire search spec in single quotes, and also implicitly converts it to a string (This makes a good candidate for an eScript framework function)

So when you apply the above function to the sValue variable, Siebel will take the literal expression.

Unfortunately for me, i put this into a class called terrorist, and created a pointer to function called Escape.

In retrospect, i admit that does look suspicious, I'll think of better class names/function name combinations in future.

The real difference between SWEAlert and alert

[TheApplication().SWEAlert Vs alert]

Veteran Siebel developers will know the textbook difference between theApplication().SWEAlert and alert

Here is the usage description from Siebel Help.

"Use SWEAlert() instead of alert(). With alert(), pop-up applets such as MVG and pick applets are hidden (sent to the background) when a JavaScript alert() is raised by a Browser-side event. With SWEAlert(), the dialog's parent applet is not sent to the background"

In other words use, SWEAlert() if you want your message box to appear in front when using popup applets, however there is an important omission in the above description.

[About SWEAlert]

The method SWEAlert is part of a client side class that invokes a method on an obscured ActiveX interface, as shown below.

App().ShowMessage("MSGBOX_ALERT", text);

ShowMessage will internally grab the window reference of the popup and create a message box in context of that window, which allows the message to be displayed in front of all other applets and...

It also will encode all the HTML codes in your message.

theApplication().SWEAlert("&#169") //(c)

theApplication().SWEAlert("&#174") //(r)

theApplication().SWEAlert("&#153") //(tm)

This is supposed to show the (tm) trademark symbol, but it dosnt seem to be able to represent this.

Understanding this behaviour can prevent defects in your application; the most common symbol developers should watch out for, is the & (ampersand) representation.

Imagine you've got a label like the following on your applet

If you had script that grabbed the source code of the label, and attempted to use SWEAlert() to show the value of the source code, it would show you the value on the UI, and not the literal value as shown below.

Dieter Bohlen & Thomas Anders

The bottom line is, dont rely on SWEAlert for debugging, using alert is alot quicker, but if you are serious about debugging browser script, using a javascript logger will save you the frustration.

So what if you want to use SWEAlert to show the unencoded value?

To force SWEAlert to display "&", we need to encode the first character of the encoding as so:


There is one more slight difference.

Siebel could have re-used the standard alert command in javascript, and run it against the modal window to get it to appear in front, but it choose to implement its own message box, why?

The msgbox title.

The standard alert title displays "Message from webpage" which cannot be changed, if you look at the title for SWEAlert, it has "Siebel" as its title.

Note: German readers will pick up on the references to Euro pop in this article, but if you're not so lucky to have grown up with these guys, Thomas Anders, was a famous singer from the 80s and Dieter Bohlen is probably the most successful music producer out of Germany and Axel Breitung would be a close second.

Reader Challenge - Mouseover Tooltips (Scriptless)


Display a floating tool tip with dynamic text, when a user hovers over a form applet label or image in High Interactivity.

[The challenge]

Our earliest followers will remember this requirement as one of the Impossible tasks on our first poll (which was won by the Scriptless VBC).

I'm sure veteran configuraters, get asked this requirement all the time from green BAs.

Does it sound impossible? It should, because mouseover interactions are not supported in HI, and to make this more interesting, lets add a condition to make this a scriptless challenge. We havnt had a scriptless challege since the "EAI Phone format challenge"

By scriptless, i'm going to borrow @lex's definition:

"I define 'scripting' as the attempt to solve requirements such as automation, validation or integration in Siebel CRM by inserting custom code into the event handlers exposed by the Siebel application.

As we all know, Siebel CRM has four object types that expose event handlers:

* Applet
* Application
* Business Component
* Business Service

I should also mention that, there should be no scripting or CSS changes to the Siebel browser framework, everything should be configured inside of tools.

The following screenshot shows an example of an advanced tooltip, that i configured earlier.


This tooltip should not dissapear after 5 seconds. ie, if there is paragraph of text, it should allow the user ample time to read the tooltip!

Have fun.