Funky Town: Inline Field Validation

This post is part of the Funky Town series of articles, where we take ridiculous User Centric Design (UCD) requirements and put them into practice.

In this article, I look at another outrageous business requirement - Inline field validation.

Imagine typing in an email address, and as soon as you step off, the field turns red, and a tooltip style message appears, stating that your input does not meet the proper standard for an email address.



Inline field validation provides many benefits

1. Immediate help for the user
2. Affirmation that the user is doing the right thing
3. Assists complex data input requirements
4. Improves user experience
5. No server round trip required
6. Makes Siebel a joy to work with!

This is the sort of thing you see on fancy web forms, and only BA's will dream this requirement up because Siebel is a simple web application right?. Lets see how we can provide this functionality for them.

[Solution]

This solution will only work for form applets, so open up any form applet, and designate a field that will act as your "email address", for this exercise your field dosnt actually be an email field.

1. Put the following code in your email field control OnBlur handler
validateEmail(applet,id);

2. Add the following browser script to your applet
function validateEmail(applet,id){
    try{
        var sValue = applet.FindControl(id).GetValue();
        var oDoc = applet.FindActiveXControl(id).document;
   var oToolTip = oDoc.getElementById("Tooltip");
        if(sValue.length>0&&sValue.indexOf("@")==-1){//insert fancy email validation routine here
       if(!oToolTip){
           var oToolTip=oDoc.createElement("div");
           oToolTip.innerHTML=" Please enter a valid Email address eg. [email protected]";
           oToolTip.id="Tooltip";
           oToolTip.style.backgroundColor="#fff";
           oToolTip.style.color="#000";
           oToolTip.style.padding="10px 40px";
           oToolTip.style.borderStyle="solid";
oToolTip.style.borderColor="#bbb";
oToolTip.style.borderWidth="10px";
           var oHeader = oDoc.getElementById("SectionHeaderId");
           if(oHeader) {
                oHeader.parentNode.parentNode.appendChild(oToolTip);
                applet.FindControl(id).SetProperty("BgColor", "#ff0000");
            }
         }
        }else{
            if(oToolTip){
                oToolTip.parentNode.removeChild(oToolTip);
                applet.FindControl(id).SetProperty("BgColor", "#ffffff");
            }

        }
    }catch(e){
    }

}

3. Create a section header for your form, add the following in the caption override
<span id="SectionHeaderId">My Funky Form</span>

Re-compile your applet, and type in some junk in your email field. As soon as you step off, your field will turn red, and a message will appear to notify of the error.

Suffice to say, the email routine that I used above is not foolproof ^_*, but you get the idea. A more wholistic solution would look at validation from a general perspective, but that is left to the reader to run with.

[Conclusion]

1. Will it perform well?
Yes, there are no server calls.

2. Is it maintainable?
Yes, if the code is made production ready, and all the validation routines are centralised.

3. Can it be upgraded?
Yes, as it does not use any undocumented methods

and

4. Is it sexy?
Yes, its a BA's dream come true

Funky Town: Sexy Salutation

This post is part of the Funky Town series of articles, where we take ridiculous User Centric Design (UCD) requirements and put them into practice.

[Background]

On the Application Home page screen, Siebel provides us with the ability to close individual Applets, and hide them from the home page. Applets can also be hidden by default in the View definition, and users can display the applets again through the Edit Layout view.

This is actually what a home page actually looks like when you hide all the applets.

To the uninitiated, it looks like the data has disappeared or deleted! Surely this cant pass UAT, yes laugh it off, give your users some training and tell them not to party on the weekends and come to work switched off. However you may take an important design principle to heart - Design for the lowest denominator.

How about we give our users a friendly message that reminds them their data is not goneski, its just not visible.

This message will dynamically appear when there are no applets displayed, and slide down smoothly like an accordian, just to give your users that feelgood feeling, and make them wonder why other parts of Siebel is not sexy like this view.

This solutions relies on a Javascript library called jQuery, which allows the developer to easily select and manipulate DOM elements. Never heard of jQuery? You are probably one of those people who are stuck in a web time warp from early 2000s. Circa 2003, there was an explosion of JS frameworks, that provided web developers a new level of abstraction on JS which provided developers with the tools to achieve easy cross browser compatability, stream line their code, and focus on functionality.

Is it production ready? Dont worry, you'll be in good company. Dont hesitate, get it now, and learn it.

Implementation

1. Download jQuery, and include it into your top object

This can be done in application start or a common Page container web template. If you are taking the latter approach back this file up.

2. Identify the web template that your Home Page View is based on

I should now stress that you should not put any javascript logic in your web templates. Any javascript logic should be offloaded into an external file for performance, maintainability and upgrade reasons (In this case the latter is more important than the rest). Plan this out carefully before you attempt to implement this solution.

3. Put the following code in the external file that handles all your home page behaviour

function j(expr){
return top.$(expr,document);//references the top.$ that was loaded in step 1.
}
j(document).ready(function(){//waits for the home page document to finish loading
try{
if(j("[class*='AppletStyle']").length===1){//if the number of applets rendered is 1 (ie Only the Edit Layout Applet is shown), display our fancy message.
var sText = "Your Home Page data is currently on holidays.

"+
"If you would like to see your data, click on the 'Edit Layout' button, then click ";
var sDiv="

";
j("div.Welcome").append(sDiv);//attach a fancy message
j("div#Msg").slideToggle();//use some jQuery magic to make the message animate by sliding down.
}
}catch(e){
}
});

If you loaded jQuery from your Application, you'll have to re-compile, otherwise, if the library is loaded from your web template, you'll just need to re-start your dedicated client, or restart the server, if you are implementing this on the server.

The "beauty" of this solution is that there is no clunky server side co-ordination, and all the logic is performed client side, so it performance translates to a silky smooth experience.

Conclusion

1. Will it perform well?
Yes, no server side components were abused to deliver this functionality

2. Is it maintainable?
Yes, just like web templates, images and other external configuration

3. Can it be upgraded?
Yes. Dont put your code in your templates. Make the effort to offload this to an external file, otherwise dont do it at all.

and

4. Is it sexy?
It is fun and sexy.

Funky Town: Custom UI Extension

This post is part of the Funky Town series of articles, where we take ridiculous User Centric Design (UCD) requirements and put them into practice.

[Background]

I was commissioned to design a custom Integration framework for a client. As part of this framework, the client needed to have a test harness that allows:

1. The developer to generate a pre-populated SOAP request for any predefined Siebel Web Service, with run time data and authentication headers.

2. Allow the developer to send the request and see the SOAP response in real time in the UI

3. They should also be able to modify the SOAP request on the fly and re-submit the message

4. and all of the above for XML over MQ as well

The design needed to load a run time data into the request, but the test data itself was transient and did'nt need to be saved. The size of the payloads are always unknown, especially when dealing with binary encoded data, the response would be massive, so I needed a way of storing unlimited data on the UI.

The closest thing that resembled what i wanted is the Script Editor Applet (Business Service Script Editor Applet2) under Business Service - Administration. Its just an applet with a massive text area, however the field that it maps to has a physical limit.

The idea was to design a custom IE window that could load the request message based on some predefined integration settings, allow the user to modify the request through a text area field, submit it to the transport, read the response and display it on the custom UI window.

This article will focus on how to build a custom window and handle the two way communication between the custom client and Siebel server. Details around integration points in Siebel will be glossed over.

[Design]

This is what the finished product looks like.



1. The chain of events starts when the user clicks on a button called "Launch Harness" which invokes "TestIntegrationCall" to launch our custom window.

a) On WebApplet_PreInvokeMethod of "TestIntegrationCall", we call a process that Generates Request message

In code it would look like this

switch(MethodName){
case "TestIntegrationCall":
//Generate a sample request XML and store it in a Profile Attribute that can be access by the browser
TheApplication().SetProfileAttr("REQUEST_MSG",[Your Request Msg]);
break;
}


b) On Applet_InvokeMethod TestIntegrationCall, we create an IE Window with the following code

//Browser Declarations
var results;

//Applet_InvokeMethod

switch(name){
case "TestIntegrationCall":
results=window.open('','Test Harness','height=600,width=900,scrollbar=yes,resizeable=yes');
var sendButton = "<input type='button' value='Send Request' onclick='opener.sendServerRequest(this)' /><br />";
var requestXML = "<textarea id='request' name='request' rows='30' cols='50'>"+ theApplication().GetProfileAttr("REQUEST_MSG")+"</textarea>";
var responseXML = "<textarea id='response' name='response' rows='30' cols='50'>"+ theApplication().GetProfileAttr("RESPONSE_MSG")+"</textarea>";

var html = "<title>Test Harness</title>"+
"<body style='background-color:#bbbbbb'>"+info+"<table><tr><td>"+requestButton+requestXML+"</td>"+
"<td>"+responseButton+responseXML+"</td></tr></table><br />"+sendButton+"</body>";
results.document.write(html);
results.focus();
results.document.close();
theApplication().SetProfileAttr("REQUEST_MSG","");
theApplication().SetProfileAttr("RESPONSE_MSG","");
break;
}


2. Using the "requestXML" variable in the step above, the Request message is injected into the 1st text area as part of the IE window creation process.

3. Applet_PreInvokeMethod SendRequest
Do nothing.

4. Applet_InvokeMethod SendRequest
Invoke a browser function that will invoke a server method that will initiate the integration call

This is initiated, from the "Send Request" button on our new created UI, which was created in Step 1b.

var sendButton = "<input type='button' value='Send Request' onclick='opener.sendServerRequest(this)' /><br />";

When the user clicks on "Send Request", it will use the "opener" method to lookup the parent window, which is the Form Applet and call the
sendServerRequest
browser function which is defined on the Form Applet as so.

function sendServerRequest(win)
{
var requestXMLStr = win.document.getElementById("request").value;
theApplication().SetProfileAttr("REQUEST_MSG",requestXMLStr);
applet.InvokeMethod("SendRequest");
theApplication().SetProfileAttr("REQUEST_MSG","");
}

Notice that we pass in "this", which is the handle to our custom IE window, this lets us read the values from our custom window.
The first line grabs the XML request from our text area, and calls a server side event.

case "SendRequest":
//Get Request String from our custom IE window
//Convert to correct format and calls the interface

5. The above code will make the interface call and return the results back to our Form Applet, which will convert the Output to a string and store it in a ProfileAttribute which will be accessed by browser script to inject back into our custom IE window as shown in the next step.

6. Get the handle for the IE window, and inject the results into the 2nd text area

case "SendRequest":
var responseXMLStr = theApplication().GetProfileAttr("RESPONSE_MSG");
results.document.getElementById("response").value = responseXMLStr;
theApplication().SetProfileAttr("RESPONSE_MSG", "");
break;


Here are the sequence of events again

Open test harness

1. Browser PreInvoke TestIntegrationCall - Do nothing
2. Server PreInvoke TestIntegrationCall - Generate Request message and convert to string
3. Browser Invoke TestIntegrationCall - Construct IE window and Request message
4. Server Invoke TestIntegrationCall - Do nothing

Send request

1. Browser PreInvoke SendRequest - Do nothing
2. Server PreInvoke SendRequest - Call interface
3. Browser Invoke SendRequest - Injects the response into our Custom IE window
4. Server Invoke SendRequest - Do nothing

[Conclusion]

We have just designed a complex, yet highly unique and functional test harness to assist developers in their day to day jobs, however the concept of a custom UI window can be extended to any part of the application that requires features that are not available out of the box.

Lets look at our criteria again

1. Will it perform well?
N/A. It is a fit for purpose utility

2. Is it maintainable?
Yes, if the code is made production ready

3. Can it be upgraded?
Yes, as it does not use any undocumented methods

and

4. Is it sexy?
It is a no contest, it is like beauty and the beast.

Funky Town: Friendly Siebel Applets

This post is part of the Funky Town series of articles, where we take ridiculous User Centric Design (UCD) requirements and put them into practice.

[Scenario]

The business wanted yet another button on a common applet, but the applet was already crowded with buttons (pictured below). The plan was to consolidate the functionality behind the different buttons, and reduce the clutter on this applet, as it was becoming a real eye sore.



I advised on removing the last two buttons, as they were too specific and its appropriateness was questionable, but i was told that users loved those buttons as they are the two most heavily used buttons in the application! Since the client was paying my wages, who am I to argue?

The second idea was to combine the 3 search buttons into one, since they all perform the same basic functionality "Search"

"Search Client Id"
"Search Client Name"
"Search Client Address"

The problem was, in the current design, the above buttons each invoked a separate VBC Search applet which called an external interface that only allowed mutually exclusive queries by Id, Name or Address, which is why they were designed separately in the beginning.

The agreed design going forward, was to combine all the fields of the above 3 applets into one super search applet, but we needed a way of preventing the user from entering data into different search categories on the same interface call.

The standard approach is to use validation to return an error message when the user hit the "Submit" button. This option achieves the requirement, but it provides a horrible user experience. Imagine the user filling in every section of the form, because it allowed them to, but when they click "Submit", an error pops up, the form is returned to the user, and they have to go through and re-fill the form correctly.

We should aim to design our application to be more intuitive (take inspiration from what Apple did with the Smart phone market =), so the proposed design was to have the fields in the relevant section dynamically became read only or read write as the user typed, this will block out fields that cannot not be filled in.

[Requirement]

a) There are 3 sections, A, B & C on a Search applet.

When the user begins typing in any one section, all the fields in the other two sections should be disabled.



Eg.
If a user types something in a field under section A, all the fields in section B&C would be disabled.

If a user types something in a field under section B, all the fields in section A&C would be disabled.

If a user types something in a field under section C, all the fields in section A&B would be disabled.

b) When the user clears the all field values from any section, all the fields in the entire applet should be re-enabled again.

[Solution]

In HI, there are two control events that are usable on form applets.

onBlur
onFocus

We will use onBlur, because when the user moves from one field to the next, we can implement logic to dynamically enable or disable the rest of the fields on the applet.

Firstly put in our trigger on each control that is editable by the user, put the following code in the onBlur handler

setSectionReadOnly( [section id] );

[section id] is a predefined identifier that you assign to each section in the form. It can be called anything. In our form applet, there are 3 sections, which we'll call a, b, c.

So for all the fields under section "a", you would put the following in each fields onBlur handler

setSectionReadOnly("a");

For every field under section "b", you would put

setSectionReadOnly("b");

and so on.. what this does, is tell our yet to be created function, that every time the user leaves an editable field, send the current field section to our function to determine the UI behaviour.

Now we define the function that is responsible fore enabling/disabling the fields dynamically.

declarations()
var thisApplet = this;

function setSectionReadOnly(sSection)
{
//control object defining allowable applet search sections
var oCTRL = {};
oCTRL.a = ["Id Type","Id Num"];
oCTRL.b = ["Family Name","Given Name"];
oCTRL.c = ["Address Line 1","Address Line 2","Address Line 3", "Address Line 4"];
var bNotEmpty = false;
try {
//check current search section for existence of a search value
for (var i=0;oCTRL[sSection].length>i;i++){
if (thisApplet.FindControl(oCTRL[sSection][i]).GetProperty("ReadOnly")=="true")
return;//abort if active field is RO
if (ctrl.GetValue().length>0){
bNotEmpty=true;//flag first non empty field
break;
}
}

//if current search section has a search value make every other section RO
if (bNotEmpty){
for (var key in oCTRL){
if (sSection!==key){
for (var i=0;oCTRL[key].length>i;i++){
thisApplet.FindControl(oCTRL[key][i]).SetProperty("ReadOnly", "TRUE");
}
}
}
} else {//if current search section is empty then make the whole applet RW
for (var key in oCTRL){
for (var i=0;oCTRL[key].length>i;i++){
thisApplet.FindControl(oCTRL[key][i]).SetProperty("ReadOnly", "FALSE");
}
}
}
}
catch(e) {
//handle error
}
}


Compile your super friendly search applet, and watch your users frustration disappear =). I'm sure you'll agree that dynamically disabling irrelevant fields, and preventing users from entering invalid data is much more friendly, than allowing them to enter invalid data, and complain that the user got it wrong afterwards.

The implementation in this example, was used to illustrate a working concept, there are numerous ways of optimizing this code to perform better, so it should not be copy and pasted across your application.

[Conclusion]

1. Will it perform well?
Yes, there are no server calls, and all the magic happens client side, saving a round trip to the server.

2. Is it maintainable?
Yes, if the logic is made production ready

3. Can it be upgraded?
Yes, as it does not use any undocumented methods

and finally the litmus test

4. Is it sexy?
Yes, and it is also very intuitive

Funky Town

A lot of articles on Impossible Siebel are an exploration of what is possible than what is normally recommended, it is hoped that readers would take these ideas, concepts and techniques (added with some common sense) to solve tricky requirements, within the guidelines of each project.

But what are the consequences when we say no to unconventional business requirements?

[Experience 1]

Recently i walked into a local communications store, to buy a new cell phone. The clerk was training a new starter on how to use the system, and i noticed that they had Siebel eChannel on their monitor, which started grab my interest.

The clerk explained to his apprentice, that they needed to check to see if i am an existing customer, otherwise they will need to create a new account for me.

Because i didn't know whether i had an account with this company or not, they had to first search for my details in their system. This is when the clerk told his apprentice, to switch away from Siebel to this other web based application to perform this search and create my account. The clerk explained to his apprentice that, this other system was easier to use.

-Score-
Siebel: 0
Web based system: 1

[Experience 2]

I had a similiar experience at my local bank, when i met with my banker. I knew the first thing that he was supposed to do, when we sat down was open up his Siebel application, and start a "needs conversation" with me.

A "needs conversation", is process where the banker should go through an interview type transaction, ask me a series of questions relating to my current circumstances, and put this data into Siebel. At the end of the process Siebel would come up with a list of recommended products to offer me.

I knew this, because i knew the team that delivered this functionality. Instead the banker used a java portal to look up my details and get a summary of my data. He wrote everything about our conversation on a piece of paper and made up some recommendations from his head. Interestingly I also knew the other team that developed the java portal, and the UI was so intuitive, that i didn't blame the banker.

-Score-
Siebel : 0
Web based system: 2
Paper based system: 1

[Experience 3]

I walked into a rival bank, and told them i wanted to open a business account. As i sat down with this employee, he used his CRM system to record my conversation, i was quite alert to this, and i asked him to show me his application. He was quite proud to show it to me, because it was a very nice .NET application that was fluid, responsive, the UI was very clean and minimalistic. It was also very sexy, and you can tell the UI was built by a well paid designer, not just some guy in the team that does web design as a hobby.

-Score-
Siebel : 0
Web based system: 3
Paper based system: 1

[User Centric Design]

Custom applications have the advantage over Siebel in user friendlyness, because there are things that you could do with current web technologies that are never "possible" in Siebel,

Lazy loading UI
Async calls with callbacks
Fancy transition animation
Dynamic UIs
Inline field validations
Word completion

etc

But lets not dwell on the negatives too much, because Siebel is a vast product with a lot of technologies that allows us to build a descent and usable interface. If you're lucky enough to work in an organisation that has a good User Centric Design (UCD) team, that hasnt been contaminated by limitations of Vanilla Siebel, get them involved during your solutioning and prototype stage.

Try to mould the application around UCD principals, and avoid designing form applets with 100 fields, with 10 different buttons scattered across the top. The problem is Developers arnt Designers and Designers are often told that Siebel is impossible.

[Go the extra mile]

There is an argument that, the user should learn to live with what the system has to offer, and with proper brainwashing...sorry, i meant training, the user will get to use to its limitations and accept it.

But there is another "school of thought" which says, if the technology is out there, and its supportable, use it and give the client what they want, of course it has to be supported by good architecture, but go the extra mile and make life better for the user, because you don't want the user switching to another application.

The question is, whether we should give the users what they want, knowing that what they ask for will have some future upgrade or maintainance effort, or throw bookshelf at them and say its not possible.

Remember the risks, if we dont give the user what they want, they will use another system or worse, use a piece of paper instead.

Imagine, that a few years down the track, business decides to build a new web 2.0 portal to interface with Siebel as a back end, because it dosnt meet certain usability or accessebility needs. Look further down the track, this sexy portal takes over, and Siebel becomes a legacy system that is too costly to maintain, it is de-comissioned and replaced with newer technology.

Lets take a one last look at the scores again.
Siebel : 0
Web based system: 3
Paper based system: 1

So next time, the business asks you to perform some unconventional configuration, ask yourself these questions

1. Will it perform well?
2. Is it maintainable?
3. Can it be upgraded?

and

4. Is it sexy?

This is the beginning of a series of articles, where i'll introduce a funky requirement, and you guys tell me, if you would go the extra mile to implement it, and along the way we'll tackle some of the impossible limitations above.

Siebel MTOM Attachments

Audience

This article highlights the importance of MTOM in the enterprise, and provides a high level overview of the challenges that I faced bringing the MTOM standard into Siebel. Due to the proprietary nature of the environment, the source code for the implementation cannot be provided, but it is hoped that this article will provide a strategy for system designers/architects out there wishing to achieve the same goal and bring their project forward into the 21st century.

Background

As we slowly move towards the paperless society, handling attachments becomes a crucial part of the Enterprise Messaging landscape. With the popularity of Web service SOA architectures, SOA professionals found themselves with a tricky challenge. How to send binary data in XML?

XML is a textual data format, it has to be well formed and contain legal characters. If you take a binary string and put it between a set of tags, certain characters of the binary string may prematurely escape the tag, or make the XML invalid. In the early days SOA professionals got around this problem by encoding the binary string into Base64 format, which allows binary data to be represented in ACSII format. Although this does solve the problem of transmitting binary using XML, it is not very efficient. A Base64 string is 33% larger than the raw binary, which means more resources are need to handle the larger message, as well as taking longer to transmit.

The next evolution came when SOA professionals realized they can use MIME to send attachments, and thus SOAP with Attachments (SwA) was invented. In short its just an XML message with the binary data tacked at the end of the payload. The attachment is distinctly separate from the payload, which means the message processor has to implement logic to get the URI and retrieve the attachment, another downside is that SwA does not support Web Service Security (WS-S).

MTOM is the next advancement in attachment messaging, which combines the best of SwA and XML with inline attachments. MTOM is based on a slightly modified version SwA, which utilizes an XML Optimized Packaging (XOP) command to logically include the attachment as part of the message, instead of just referencing to the location of the attachment, it also supports WS-S.

That was 2004, today is 2011.

MTOM and Siebel

Siebel does not support MTOM, or even MIME through WS, the only supported method of sending attachments is through Base64 encoding. Base64 works well for small attachments, and is universally accepted, but what happens when Siebel is required to handle large attachments? There is little choice, it is Base64, MIME (non WS), or hire a technical architect that will design a custom MTOM framework for you.

Creating MTOM Messages

There are several approaches to creating MTOM messages in Siebel, here is a high level run down of the options.

Option A

1. Query IO and get a SiebelMessage with Base64 encoded attachments
2. Pass SiebelMessage to JBS, to construct a MTOM message and create the XML payload
3. JBS converts Base64 to Binary stream and appends to the above MTOM message

Adv: Easy to implement, No file management
Con: The Attachment will be converted from Binary to Base64, and back to Binary each way


Option B

1. Query IO and Get a SiebelMessage with Base64 encoded attachments
2. Convert SiebelMessage to MIME Hierarchy in Siebel
3. Parse MIME binary chunk to JBS
4. JBS reconstructs the MIME to MTOM structure, and inserts the proper XML payload

Adv: No file management, good fun for Java programmer
Con: Difficult to implement for a Siebel developer,
The Attachment will be converted from Binary to Base64, and back to Binary each way


Option C

1. Extract file attachments to filesystem
2. Pass file locations to the JBS
3. JBS reads file into memory, creates MTOM message and XML Payload
4. Delete extracted files

Adv: Easy to implement, Attachment is never converted to Base64.
Con: File management. Increased disk IO.


MTOM messages can be created using standard MIME classes, since MTOM is packaged as a multi part MIME message. After the MTOM message has been created, it can be passed back to Siebel or sent to the transport directly from the JBS.

The main theme in these options, is the usage of Java Business Services (JBS). eScript does not have any methods to retrieve binary from a PropertySet, hence it needs to be passed down to a JBS where it can be retrieved, and manipulated.


Importance of MTOM

Dealing with attachments is Business As Usual for many industries. For example, record keeping is a core part of every Government departments DNA, it serves as a means for accountability, and preserves memory for historical purposes. With the proliferation of broadband, hospitals can send X-rays and other medical documents to roaming doctors. Insurance companies can process claims through PDF and automatically store them in the document management system. Integrating with document management systems becomes one of the key programmes of work in the Enterprise, and handling attachments efficiently becomes a key non functional requirement.

The world has moved to MTOM, and for Siebel to remain relevant it must keep apace with new technologies, otherwise it risks becoming a legacy system. There is no immediate risk for Enterprises that deal with small file sizes, as Base64 is still an acceptable technology, as long as your ESB still supports it, but it will not scale well into the future, especially with High Res/HD content becoming mainstream on the horizon.

The problem arises when your Enterprise makes the decision to embrace MTOM, and when the Enterprise architects are deciding which projects will provide the file attachment functionality.

The question they will be asking is your Siebel project MTOM capable and ready?

Browser Script Debugger

One of the joys of working with Siebel is debugging Script, those late nights troubleshooting spaghetti code sure brings back memories. It is even more memorable when you encounter code that has never been unit tested, and wonder how did this ever get into production..

Ah the good times, but where would the fun be without Siebel's debugger. Set a break point where you think the error is occurring, let the application run, and Siebel will halt the execution of the Application at your designated break point, it will display all your current variables, and let you step through the code line by line.

Browser Script on the other hand has always been the poor cousin of eScript, it lacks the interactive debug tools, which has always made it harder to work with. Make a typo in eScript, and you'll probably get a compile error or it will halt your application, but with browser script, a typo will silently fail and halt execution of every other browser script in your application, its quite insidious.

There are a few common methods that developers rely upon to debug Browser Script.

The Alert/SWEAlert box is helpful but annoying and painful when working with loops. I know of people who have implemented browser popups that log information to a separate window, not bad, but dealing with popups is too clunky and slow. Siebel also provides the browser trace files similar to eScript, but a much better tool is the the IE Developer toolbar (IEDTB). It is shipped as part of IE8, but had been available as a separate Add-on for previous versions, if you've used Firebug on Firefox before, then this will be familiar to you.

The IEDTB allows the Siebel developer to

1. debug browser code
2. add breakpoints
3. use log statements
4. watch run-time objects and variables
5. inspect DOM elements
6. run code against the active session
etc, etc

In short, it is pretty badass.

If you are ready to turn to the dark side, press F12 on your keyboard now, otherwise press ALT-F4.



Logging

The IEDTB provides the browser with an object called "Console", with the following methods.

console.log('start function');
console.info('We love disco');
console.warn('warning');
console.error('error');
console.assert((1==2), 'Disco forever);
console.clear();

These methods can be used inside any of your browser script event in Tools, and the results can be inspected in the console window as shown below.



Note. The console must be open at the time when the scripts are run.

Breakpoints

This has always been the holy grail of Browser Script debugging.

Here's how it works. In the script drop down, find the JS script that you want to debug, and select it before navigating to the Siebel screen that actually fires it.

Click the left side of the left pane to set the break point.


Now navigate to the View that contains your browser script, and trigger your function. The IEDTB will stop at the breakpoint, and allow you to step through your code.

The Local window allows you to inspect all your local variables



The Watch window allows you to focus on particular variables and even change the value during run time.





You can also retrieve the values of the profile attributes, and run other browser commands by using the script console.



This is good news for all the Browser Script Jedi's out there, the IEDTB is an in-dispensible tool for debugging browser script, and beats the hell out of plain ol' Alert or SWEAlert

Best practice has it that we implement our logic using declarative means, then go to Script as a last resort, but there is an even finer unspoken distinction. When we have exhausted all declarative means, and all eScript means, you have reached the last resort, of last resorts. Welcome to Browser script town, when you get into this bad end of town remember to bring your IEDTB.

The IEDTB has saved my life more than once, and it will save yours as well.

Searching through UTF-16 files

In a typical day of a Siebel EAI developer, we are required to investigate problems with XML/XSLT files, and unless you know the system inside out, and outside in, you may encounter XML fragments that look unfamiliar.

For example, your ESB team sends you an XML that they claim to have been sent from your system, but from looking at the XML you dont recognise the interface that sent it. However you reason that, if you could search through all the XSLT files in Siebel you could track down the interface that could be generating this file.

The most obvious tool at the developers disposal is Windows Find, this is the defacto method of searching for files or text in files in a Windows OS, but beware because this method will not yield any results when searching through UTF-16 files. Surely Unix users would have more reliable tools in their arsenal. What about Grep?

Grep belongs to the Unix family of tools who's sole purpose is for searching, so how does this command fair with UTF-16 files? Fire up any Grep tool within reach and search for "xml" within your directory of UTF-16 XSLT files.

Here were my results.





FAILPASS
Windows BareGrepX
Mac GrepX
HP Unix GrepX


To understand this behaviour, open a UTF-16 file in a binary editor, you'll see that there is a "00" byte (shown as a space character) between every character, this is how UTF-16 files are physically represented in the file system, but open it in Notepad or your favourite unicode aware editor, and it will magically render the UTF-16 code points into your familiar readable XML.

With that understanding, it becomes clear why text matches will not work in programs that use a non UTF-16 regex engine.

This is a problem for any unsuspecting EAI developer and Siebel project that relies heavily on XSLT for its request/response Integration, but knowing thy enemy is half the battle already won, so here are a few tools to deal with UTF-16 files.

1. Windows findstr
eg. findstr /s /c:"siebelmessage" *.xslt

This command can match strings in UTF-16, and can be used to search directories.

2. Notepad++
3. TextPad

The above two text editors, could search entire directories, and match for text within UTF-16 files.

With this in mind, I'm sure you could easily find other utilities and programs that can scour through UTF-16 files.

It is a little unsettling to discover that you cannot rely on such ubiquitous tools such as Find or Grep for your Integration needs, but hopefully the next time you get that foreign XML in your inbox, you'll already have a hand on a nearby UTF-16 scraper.

Server Confirm dialog (Scriptless)

[Background]

Every Siebel professional knows that its impossible to get input from the user using Server script. The rationale is that server script runs on the server, and theres no way that it can pop something up on the client. Whats more ludicrous is to do it without any script.

Google for "Siebel Confirm" and you'll get a bunch of results stating that this is only possible using Browser Script.

Search in support web and you'll probably end up with these documents

1. How Should You Implement Message and Input Boxes in Siebel 7 and Siebel 8? [ID 476612.1]

2. How Can You Display a Message from a Server Script on the Browser? [ID 477323.1]

The conclusion is the same:

"Interactive dialog boxes are features that belong to the JavaScript language and can only be launched from browser script"

That sounds like solid advice, so would you believe me, if i told you that its possible to invoke a Confirm dialog from the server, using out of the box functionality?

Did i hear someone say "NO"!? Okay, that might have been my sub conscious.

If you are not convinced, let me introduce you to an undocumented business service that does just this.

[Confirm Dialog Business Service]

Business Service: LS Pharma Signature UI Service
Method Name:
ShowConfirmDialog

Open up Siebel and goto your business service simulator, and load up the following values

Inputs:
Cancel Method Name:
MyCustomMethod1
Confirm Text:
Winona, will you marry me?
OK Method Name:MyCustomMethod2

Your view should look like this.



Click run, and VOILA.



This produces an Ok,Cancel dialog that can be used across the application, but best of all, it is scriptless.

Now click either button, and you should get an error.


This happens because we havnt configured the application to handle these custom events, but lets try to invoke methods that we do know exist, and we'll perform some real configuration instead of basing our results off the simulator.

[Configuration]


Find your favourite BC and add the following user property, this will enable a custom method, and call the business service to display our Confirm Dialog.

Named Method

"InvokeAction", "INVOKESVC", "WS Transaction Settings", "LS Pharma Signature UI Service", "ShowConfirmDialog", "'Cancel Method Name'", "'NewRecord'", "'Confirm Text'", "'Hello'", "'OK Method Name'", "'DeleteRecord'"

Next find your favourite applet, and add a new button and set the following property:

Method Invoked: InvokeAction

The Ok and Cancel method definitions, will fire the respective events from the Applet to the BC, and from Browser to the Server, just like normal events, which you can subsequently trap and perform the intended action, based on the user response.

[Results]

NewRecord
This creates a new record in the applet

NewQuery This toggles the applet into Query mode

DeleteRecord
Interestingly, this brings up another confirm dialog. Infact, it looks damn similiar my own confirm dialog, except for the question text.

[Conclusion]


If you look hard enough, you'll find examples of this all over the application, heres another business service that does the same thing, except the message, and return codes are hard coded

Business Service: LS SubjectVisits Service
Method Name: ShowConfirmationDlg

This raises a few questions in my mind

1. Why isnt this documented?
2. Can we have control over how the dialogs are presented?
3. Can we display a message or prompt dialog in the same manner?

Maybe someone from Oracle engineering can answer this, but suffice to say, this is a great little nugget for Impossible Siebel readers.

On a closing note, if you would like more pizazz in your popups, change the buttons or add an icon, have a read of Alex's UMF Series, on Siebel Essentials. It should cover my requirements above.

Siebel Unified Messaging Framework - Part 1

Siebel Unified Messaging Framework - Part 2

Quick GenBScript By fkirill

Recently, I was contacted by Siebel Master Kirill Frolov, who shared with me his new Browser Script generation tool. What I found impressive about this tool, is that it can generate browser scripts in under 5 seconds!.

This is really exciting, and I’m sure you guys/gals will think so too. The following article was written by Master Frolov, to explain the design of his program.

-----------------------------------------------

Brief Introduction

All of us, those who deal with Siebel customization in local machines, know that GenBScript generates browser scripts by parsing SRF fie and puts them into a special folder and this folder is names uniquely based on some not very obvious rules. The process itself takes (depending mostly on CPU) from 1 to 3 minutes.

If you have automatic SRF compilation during the night, you have to use GenBScript every morning when you replace the SRF.

Additionally if you have several environments (prod, prod copy for support, upcoming release test, integration test, load test etc. to name a few) and you have to switch from one environment to another throughout the day, time consumed by GenBScript may reach up to 1 – 1.5 hours.

Though incremental compilation of an applet with browser script puts browser scripts in the right directory (if you managed to set up the corresponding options in Tools), the are still a lot of cases when you need to run GenBScript by hand.

The proposed method allows quick and painless method of producing the same result as GenBScript but using slightly different approach to gain performance improvement.

Our tests show that in most cases it gives less than 10 seconds per run (mostly around 5).


Idea behind the proposal

My goal was to reproduce the result of GenBScript as close as possible so first of all I prepared the list of questions needed to be solved for that purpose:

1. How to determine the folder name to which GenBScript result is placed?

2. What’s the difference between the script sources in editor and the resulting scripts in *.js files?

The idea behind the method is to use script sources from database instead of SRF file to produce result as close as possible to original GenBScript and do it as quickly as possible.

To answer both of these questions we need to perform some analysis.

Firstly about the folder name. The folder name is constructed using two parts:

srfXXXXXXXX_YYY. For those of you who are familiar with unix or java, it should be familiar that the time is measured by counting seconds (or milliseconds) from 1st of Jan, 1970. So after some research I realized that XXXXXXXX – is the number of seconds passed from 1st of Jan 1970 when then last full or incremental compilation took place. The seconds part YYY seems to be dependent of whether the SRF is a full compile or an incremental compile.

The problem here is that XXXXXXXX not a creation or modification date of SRF file itself, but a part of an internal record in SRF file.

To approach this issue we need to remember that some time ago there was an article in one of Siebel-related forums stating that SRF file is no more than bare OLE document (which is also used by older versions of Microsoft office system) which is essentially a container format which has its own internal file system. By the way you can easily prove that opening SRF file in 7-zip archive manager which supports this format.

So after some effort I found out that the number of seconds from 1st of Jan 1970 is stored in one of two records which named… surprise-surprise… “Full Compile” and “Last Incr. Compile” respectively and are stored in the root of internal file system. Both of those records have 384 bytes in length and the seconds value is stored in bytes 4-5-6-7 (in reverse order).

So we need to parse SRF records to find one of the entries named “Full Compile” or “Last Incr. Compile”. If latter is found then we have an incremental SRF otherwise full-compiled. The second part YYY as I already mentioned depends solely on whether SRF in question is incremental or full compile. Respectively you need to use 612 for incremental and 599 for full compile.

The second question. How to organize script source code (which we have in repository database) into a bunch of script files. Well, I found out that there are quite a few changes between source code in repository and resulting script files.

1. Scripts are aggregated to parent object. This means that there is one script file per Applet/Business Service/Business Component/Application (with some minor exception for an Applet objects)

2. Names of pre-defined functions are prefixed with escaped name of a parent object

3. Applets have two script files one for controls and one for all the other functions.

I will omit all the details here, this is not really complex. You can look up source code if you wish to find them out yourself.

The implementation

The program is written in Java as single Java-file which contains numerous child subclasses.

To parse OLE file format I used apache POI library which has convenient methods to parse office documents (the funny thing is that file format is called HPSF which stands for Horrible Property Set Format :-) ).

To perform database operations I used jdbcType4 Oracle driver (jdbc6,jar from jdbc/lib folder of Oracle installation home).

Note about supported databases: in theory program should work in any database used in develpoment environment (I mean Sybase (through ODBC), MSSQL (through ODBC) and Oracle (native type 4 (thin), native type3 (TNS) or ODBC). I don’t have any idea about more exotic DB2 but I assume they are not used in development very frequently anyway. I tested only for Oracle but kept in mind other databases during development.

Testing method I used is standard text-compare. The only issue I ran into is that there is no specific order of methods in repository for browser script as they present for server scripts. This make impossible to make binary compare between GenBScript and QuickGenBScript. No other script text differences were identified.

The program was written in one working day, it is fairly small (around 700+ LoC). I and two of my colleagues use it permanently for several week already, no issues found so far.

Installation/Configuration
The program itself is run without any input parameters. This is done intentionally to promote ease of use. Based on my experience, it is easier to spend some time for initial set up than to enter some parameters each time you need to run it.

So the configuration is done through editing two text files (db.properties for database parameters and srf.properties for srf parameters). The program looks for these files in working directory (may not be the same as program directory). If you need to run QuickGenBScript for several environments it is worth doing several folder (each folder for single environment) and place both of db.properties and srf.properties in each of those folder. Then setup environment parameters for each environment and bat-files to run QuickGenBScript in those folders. Alternatively you can set up several installations of QuickGenBScript since it is quite small anyway.

What to configure.

db.properties
ConnectURL - url to database according to syntax for a given driver. Example: jdbc:odbc: for ODBC driver, jdbc:oracle:thin:@:: for Oracle thin driver.

DriverClassName - fully-qualified database driver class name. For example, sub.jdbc.odbc.JdbcOdbcDriver for an ODBC driver and oracle.jdbc.OracleDriver for oracle database driver

Login - database user login

Password - database user password

UseSchema - valid values are “true” and “false”. Whether to prefix table names with schema name (required for oracle when user name is different from siebel system user name)

SchemaName - the prefix to use for database table names. Schemas and table names are separated by dot (“.”)

RepositoryName - the name of Siebel repository to use as a source of browser script data. Normally this should be “Siebel Repository”

ShowSQL - whether to show SQL generated and some more debug output. Normally should be “false”

srf.properties
PathToSRF - path to SRF for which you need to generate browser scripts. It is used to find out the folder name where resulting scripts will be stored.

IMPORTANT: in *.properties files back-slach (“\”) must be DOUBLED. For example c:\Siebel\Client\PUBLIC\ENU\Siebel_SIA.srf transforms to c:\\Siebel\\Client\\PUBLIC\\ENU\\Siebel_SIA.srf

FullCompileSuffix=599. You need to run original GenBScript againts a full-compile SRF file and find out which is the suffix for directory where it puts generated files. In version 8.0 this is 599.

IncrementCompileSuffix=612. The same for increment SRF.

TargetDir - the root public\enu directory where generated files should be stored.

IMPORTANT: IMPORTANT: in *.properties files back-slach (“\”) must be DOUBLED. c:\Siebel\Client\PUBLIC\ENU turns to c:\\Siebel\\Client\\PUBLIC\\ENU

TargetEncoding=utf-8. Target encoding for generated scripts. Leave it as it is.

How to run
Prerequisites: JRE or JDK version 1.6. I assume java.exe can be found in PATH, so no java path is present in run.bat

run.bat contains a single line code which essentially includes apache POI, database library (jdbc6.jar in distributive) and QuickGenBScript.jar which contains all the class.files from QuickGenBScripts (quite a few).

Unfortunately initial implementation requires quite a lot of RAM to run (300M is enough). This is due to the fact that SRF file contains > 70 000 entries (in our case) which need to be parsed.

Additionally I published Eclipse project containing all that is required to run and debug QuickGenBScript in Eclipse environment.

PS: Sorry guys. almost no comments in source code, I’m just really very busy nowadays with my full-time job. I’m a bit ashamed to produce code without comments, but... That’s life. Besides, I’m willing too much to share this interesting research project with you.

Screenshots
With option ShowSQL=true


With option ShowSQL=false


References:
SourceForge download page:
https://sourceforge.net/projects/quickgenbscript/files/

Source code can be obtained via SVN
svn co https://quickgenbscript.svn.sourceforge.net/svnroot/quickgenbscript quickgenbscript

Official notice: QuickGenBScript is purely for development tool, use it on your own risk. Though it’s working, it is experimental and completely unsupported by Oracle. NEVER USE IT IN PRODUCTION ENVIRONMENT!!! Nevertheless, I believe many of you will like it.
-----------------------------------------------

Thanks to Kirill, for providing the community with greater insight into the inner workings of Siebel, and improving the lives of all Developers.

I think there is one aspect that would really top this off. How do we automatically discover the suffix code for Full and Incremental compiles? I think the answer is in the SRF, consider it a challenge =).

Solution - Mouseover Tooltips (Scriptless) Part 2

This is the final article in our Impossible Tooltips challenge, if you have arrived here by accident, have a read of the precursor articles before going further.

1. Tooltips Challenge
2. Tooltips Solution Part 1
3. Tooltips Solution Part 2 (You are here)

The solution below has been freely available on the Impossible Siebel group for over a month now, and has been available to hundreds of people.

If you havnt already joined, or dont have a friend who is in the group to give you the inside information on our Siebel challenges, join now! There is no non disclosure agreement, take the information and share it.

Originally, I posted this tooltip challenge 6 months ago, but the seed for these articles started over a year ago, does any one remember the first Impossible Siebel poll? Interestingly the tooltip solution finished last on the results.


To quickly refresh your memory, in the last article, we injected artificial browser events into the label caption and used to HTML to display our Tooltips, but that solution had two drawbacks.

1) Unlimited text
2) Dynamic text

The more "important" issue here is the text length, but both these problems can be killed with one stone.

[Scriptless Solution]

The usefulness of the label caption is limited by its text length, but we can cheat by using a calculated field and put it in the position of the label, to act as the 'label' on the form applet.

This can be a little tricky, so we'll start with a basic example on how to implement this.


"<p onmouseover='alert(""Disco Forever"")'>Disco</p>"

Notice that with calculated fields, we need to enclose the expression with double quotes, and also escape any double quotes to become a pair of double quotes. There is no way to quickly simulate calculated fields, so an incorrect attempt at this expression may suggest that the idea dosnt work.

So here is our calculated field expression, with escaped quotes.

"<p onmouseover='var d=document.createElement(""div"");d.id=""t"";d.innerHTML=""Hey"";this.appendChild(d);' onmouseout='var d=document.getElementById(""t"");d.parentNode.removeChild(d);'>Disco</p>"

Create a field control, ensure that the control is set to dontencodedata and HTML Type is set to Plain Text. Map this control to your applet mode, compile these changes, and you'll notice that the real label and the calculated field behaves the same on surface value.

By using calculated fields, we can concatenate several other calculated fields together to get around the character limit, and by the nature of calculated fields, we can also take advantage of the fact that we can pull data dynamically through them. For example, we can retrieve other field values, get profile attributes, and even call business services.

However using calculated fields in this way will become incredibly complicated, especially if you have more than one field. Every field might have multiple concatenations, and the logic for creating and display the tooltips could be duplicated hundreds of times. Imagine having to change the style of the tooltip across the application, this will be quickly become unmaintainable.

This concept is only provided to illustrate that it can be done without scripting, but for practicality writing script in this case is much more sensible.

[Scripting Solution]

We will create two custom global browser script functions called showDiv() and hideDiv(), which will be fired by our artificial onmouseover and onmouseout events. This will offload the creation, as well as the styling of our tooltips, to a central place. Then all we need to do, is pass parameters to these functions, to display the tooltip.

The following example creates a really simple tooltip, but what you can do with it is only limited to your HTML skills.

Eg. you can make it float rather than append, you can add pictures, titles bars, rounded corners, play a sound etc.

Modify the calculated field, or Label to look like this:

"<p onmouseout=top.hideDiv(this) onmouseover=top.showDiv(this,'Hey')>Disco</p>"

In your Application browser script or business service, attach the following functions to your "top" object.

top.showDiv=function(that,m) {
var d=that.document.createElement("div");
d.id="Disco";
d.innerHTML=m;
that.appendChild(d);
}

top.hideDiv=function(that){
var d = that.document.getElementById("Disco");
if (d!=null) d.parentNode.removeChild(d);
}


The "expresssion" in this label caption uses about 80 characters, and still leaves a lot of room to display a useful tooltip without using multiple calculated fields, and if you dont require dynamic text, stick to using the label caption, otherwise the calculated field offers a bit more flexibility at the expense of maintenance.

You still can build some logic in the global showDiv() and hideDiv() functions to enable the label method to be a little dynamic, but it depends on how contexual you want your dynamic labels to be.

If you are one of those control freaks, then you also might want to offload the management of the tooltips text to a central location, rather than hardcoding the text as a parameter, we can hard code a reference to the label and perform a lookup.

A modified solution would look like this, create your calculated field as follows

"<p onmouseout=top.hideDiv(this) onmouseover=top.showDiv(this,'MyApplet.MyLabel')>Disco</p>"

In your Application browser script, change your showDiv function as so

top.showDiv=function(that,lov) {
var m = lookupValue("MY_LABEL_LOV_TYPE",lov);//lookupValue is a custom function that retrieves LOV values from the database.
var d=that.document.createElement("div");
d.id="Disco";
d.innerHTML=m;
that.appendChild(d);
}

This way BAU can change the labels without re-compiling the SRF, and provides clients in regulatory situations to quick adapt to changing needs.

[Floating, Appending, Positioning the tooltip]

The solution that i've provided above, appends the tooltip and positions it underneath the label, the position is always relative to the label. Some readers who i gave out the solution to, modified the solution to use absolute X,Y co-ordinates. I've also seen variations of my solution that have been modified to use <span> tags.

I've found that mouseovers dont work correctly on span tags in Siebel, so if you have problems with the mouseover not triggerring, try changing it to a <p> (paragragh tag).

Should you float or append? For short tooltips, appending is easier, because the solution is a lot less complex. When your text or styling makes the tooltip too big, it will start to push your controls out of alignment. To overcome this issue, you need to implement a floating tooltip, as seen on my screenshots on the original challenge.


[Dealing with the ActiveX]

The floating tooltip will not be effective, unless you deal with the ActiveX problem. Web professionals will know that elements on a web page can be layered, and each control can be set with a layer order to make it appear in front or behind another object.

ActiveX controls are a little different, because you cannot set the layer order on these type of controls, they just appear on top of everything else on the webpage. So if you try to implement a floating tooltip that lies in the path of a dropdown box or any other Siebel ActiveX control, your tooltip will be hidden by the control.

To get around this, we have to use a really obscure web developer trick, the "iframe technique".

var if=that.document.createElement("iframe");
if.id="iFrameDisco";
if.style.width = your tooltip width
if.style.height = your tooltip height
if.style.top = your tooltip Y position
if.style.left = your tooltip X position
if.style.zIndex='998';
if.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=0)';

The above code creates an iframe of the same size as our tooltip, the next step is to create our tooltip to sit above this iframe (it is important that both the iframe and the tooltip are the same size).

This little trick allows our tooltip to float above the ActiveX controls in Siebel and is the same technique, that i've used in the ImposSiebel toolbar to float the AboutView dialog on top of the Siebel ActiveX elements.

[Conclusion]

This solution is unconventional, even if you consider the scriptless option, and depending on what kind of effect you are after, it can become very complex, but when used strategically, your users will be happier than any other siebel user in the world.

Keeping your users happy is very critical, and will be the subject of a series of future articles, but for now, the Siebel community can say that our million dollar system can do Tooltips!

Our regular readers probably saw this coming, but this is where we introduce a disco tune to the audience.



I cant think of a better disco tune than "One way ticket" to compliment this article, wether you like Neil Sedaka, Eruption or Boney M, this is a killer disco track.

Solution - Mouseover Tooltips (Scriptless) Part 1

I've been receiving a lot of requests from Siebel professionals to provide the solution to the tooltips challenge, and though i've provided the solution privately to needing customers, i've realised that implementing it can be tricky, so in this article so i'll provide a walkthrough of the fundamental configuration needed to achieve a basic solution.

[Background]

To provide some perspective on this problem, lets have a look at a real life scenario from a customer on the Oracle forums.

"We have been struggling with a user request:

The users have requested that we change default Siebel Tooltip behavior so that if we hover the mouse over some select fields(In this case a credit code, among others) that the tooltip contain information that can help the user to understand the value. Whether this is the definition of the actual value or a short list of actual values is still up for debate. Alternate approaches like populating the status bar with a value, theoretically the definition of the current value, and providing a help icon with a tooltip or message that contains reference info for the column below, have been discussed, but these are not preferred.

So has anyone ever tried to highjack the tooltip functionality? I'm not going to say that the existing functionality (Displaying the full value of the current field) isn't useful in many cases, but that functionality is useful for the codes that we are looking at(WHich are typically smaller then the existing field) and this would be a far better use of the functionality.
"

source: http://forums.oracle.com/forums/thread.jspa?threadID=577955&tstart=525

[Million dollar system]

The Siebel UI can be quite overwhelming, so its understandable that business want to implement tooltips, to provide its users with visual clues and help the user perform their duties. This is the one requirement that every BA has asked once in their Siebel career.

But when the business ask for a simple feature such as floating tooltips, and we say its not possible. It becomes a little embarasing, when they ask why a system, they've spent millions of dollars on, cant offer tooltips, which have been around since the beginning of the web.

[Workaround]

A primitive technical solution to this, is to utilise the caption override on the label, and hard code text into the alt or title attributes.
<span alt='Disco Forever'>Disco</a>

This dosnt meet the requirement of the impossible challenge, but it also has an annoying side effect, in that the tooltip vanishes too soon. So if you want to provide a few lines of text for the user to read, they'll have roughly 5 seconds to read it all, before it disappears.

Some readers have reasonably guessed that we need to use the onmouseover and onmouseout events in browser script control events to deliver this solution, as it is the most obvious mechanism to create a floating dialog, however the only problem is, these browser events are not available in HI environments, and it also involves scripting.

But read on, and i'll show you how to bypass these obstacles.

[Solution]

To get around the HI browser events limitation, we can inject custom onmouseover and onmouseout events on the label caption as so.
<p onmouseover='<Show our tooltip>' onmouseout='<Hide our tooltip>'>Disco</p>

This lays the foundation for the rest of the challenge, and offers us the launchpad to use some HTML magic to display our tooltips.

Here is the caption override that is needed to display a tooltip.
<p onmouseover='var d=document.createElement("div");d.id="t";d.innerHTML="yeah";this.appendChild(d);' onmouseout='var d = document.getElementById("t");d.parentNode.removeChild(d);'>Disco</p>

What the above syntax does, is creates a DIV element on the fly and injects it underneath the current object, which in this case is our field label object.

Our label now has two custom events that will fire off code to display and hide the tooltip accordingly. The tooltip will hang around as long as the mouse cursor is hovered over the label, and disappear swiftly when the mouse moves away.

But lets not celebrate so soon, because this solution has the following draw backs, the tooltip text is limited by the repository length of the caption field, our creativity with the tooltips is also severely limited by the caption length, and hard coding the text here would make it difficult to maintain.

We can dress it up by adding a little style
<p onmouseover='var d=document.createElement("div");d.id="t";d.innerHTML="yeah";d.style.backgroundColor="red";d.style.borderColor="black";this.appendChild(d);' onmouseout='var d=document.getElementById("t");d.parentNode.removeChild(d);'>Disco</p>

This looks a little better, but uses it up every (255) valuable character, and leaves no room for a useful tooltip.

This is the most "vanilla" result, and is not very useful, but it does provide the basic framework for others wishing to get further with this challenge.

[Until next week]

The most important hurdles have been taken away

1) Mechanism to Display/hide a persistent floating tooltip
2) Achieved by using a caption "expression" and hence Scriptless

But the following aspects of the challenge remain un-met

3) Unlimited text
4) Dynamic text

In the next article, i'll provide the full solution and bust the myth that Siebel cant do tooltips.

Ultra browser script generator 2

A fellow colleague had a chance to test my new Ultra GenB script progress screen enhancement, and the feedback was:

"Every developer should have this"

If you dont know what the excitement is all about, a while ago i presented the Ultra GenB script generator, a free utility to ease the pains of generating browser scripts. This time i've come back with an enhancement to the original program.

The time need to generate browser scripts varies, depending a lot of factors such as the amount of browser scripts you have in your application, the amount of memory/ disk space/CPU utilization currently being used, and Genbscript.exe also runs faster off a fully compiled SRF, compared to incremental compiles, so you could be waiting 1-10 minutes for the program to finish not knowing what Siebel is doing in the background.

My browser script generator fills this user experience gap, by providing a visual cues on the progress of genbscript.exe.

[Features]

All the wonderful features of original +
1) Displays the name of the file currently being generated
2) Displays how many files have been generated so far
3) Turns Red to signal failure or user action
4) Turns Green to signal success





Note: Feature 1, works by polling the file system, so the results are not real time, hence your experience will vary depending on how fast or slow your system is running.

The file and source code can be downloaded freely from my LinkedIn Group: Impossible Siebel

Reader Challenge - Popup Applet "X" button

[Requirement]

"How to show alert to user after closing a Pick Applet from the "X" button [top right corner]. I want to show the alert or confirm(yes/no) box just after closing the pickapplet.

I tried using the window.onunload event in browser script of pickapplet, but it didn't worked.

please help"

Source: Oracle Forums
Link: http://forums.oracle.com/forums/thread.jspa?threadID=924827&tstart=195

[Challenge]

To clarify, the developer wants to display a confirmation dialog after the applet has been closed, and not to prevent the applet from being closed.

There are a few solutions that come to mind.

1. Put some code on the applet that invokes the popup applet, when focus returns to the first applet, pop up the dialog.

This is ugly because you need to put code on all the base applets across the application that use this popup applet.

2. OnLoad of the pop up applet, create a looping mechanism to check the name of the active applet, when the active applet is no longer the active popup applet, pop up the dialog.

This solution dosnt provide a real time notification, and creates un-neccessary load on the application and browser.

So your challenge is to find an alternative solution, which should be pretty tough ruling out the above possibilities.

To test the water, I seeked opinion from Michael Feng, of scriptless VBC fame, who initially dismissed it as impossible, but when I said, there is a solution.

He came up with a concept and a working solution in a few days. His solution allowed an alert to be displayed in REAL TIME when the X was clicked on a popup applet.

Its been a year since the above requirement was posted to the Oracle forums, if you are the author of the above post, or you are a customer who needs the solution, send me a message on LinkedIn, and i'll gladly fill you in.

To keep you entertained until then, heres a flash back to the 80s, and an introduction to "Joy", the greatest band to come out of Austria.



Joy enjoyed success across Europe and East Asia, with numerous hits such as Touch by touch, Hey Hello, and Valerie.

XSLT 1.0 upper-case() & lower-case()

In the last article, we looked at using XSLT "includes", and along the way, encountered a requirement to convert a string to uppercase in XSLT 1.0.

XSLT 2.0 users have the luxury of upper-case() & lower-case(), but oddly, functions for converting characters to upper and lowercase are not available in XSLT 1.0.

XSLT isnt the mother language of most Siebel professionals, or if you dont use it everyday, youre going to get rusty (i know i am), so this walkthrough should appeal to a lot of readers.

Lets take a look at our XSLT functions file from last time
<!--XSLTfunctions.xslt-->
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" /> 
    <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> 
    <xsl:template name="FORMATBOOLEAN">
        <xsl:param name="BooleanChar"/>
        <xsl:choose>             
            <xsl:when test="translate($BooleanChar, $smallcase, $uppercase)='Y'">true</xsl:when>
            <xsl:when test="translate($BooleanChar, $smallcase, $uppercase)='YES'">true</xsl:when>
            <xsl:when test="translate($BooleanChar, $smallcase, $uppercase)='TRUE'">true</xsl:when>
            <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>


It works by taking a string value, converting it to uppercase and comparing it to 3 static values, but with a little bit of effort, we can optimise it to be more efficient. Instead of calling translate on the same variable 3 times to get the same result. We will engineer it so its only called once.

We start by creating our own custom UPPER and LOWER functions
    <xsl:template name="UPPER">
        <xsl:param name="text"/>
        <xsl:value-of select="translate($text, $smallcase, $uppercase)"/>
    </xsl:template>
    
    <xsl:template name="LOWER">
        <xsl:param name="text"/>
        <xsl:value-of select="translate($text, $uppercase, $smallcase)"/>
    </xsl:template>   


In XSLT we cannot reassign the value of a variable once it is declared, so we create a new variable called $BooleanCharUPPER,and call the UPPER function from inside our FORMATBOOLEAN function and return the result.
    <xsl:template name="FORMATBOOLEAN">
        <xsl:param name="BooleanChar"/>

        <xsl:variable name="BooleanCharUPPER">
            <xsl:call-template name="UPPER">
                <xsl:with-param name="text">
                    <xsl:value-of select="$BooleanChar"/>
                </xsl:with-param>
            </xsl:call-template>
        </xsl:variable>  
  
    </xsl:template>


Finally we evaluate the $BooleanCharUPPER against our static values.
        <xsl:choose>             
            <xsl:when test="$BooleanCharUPPER='Y'">true</xsl:when>
            <xsl:when test="$BooleanCharUPPER='YES'">true</xsl:when>
            <xsl:when test="$BooleanCharUPPER='TRUE'">true</xsl:when>
            <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose>  


We can now use these functions in any XSLT, where we've included them
        <xsl:call-template name="UPPER">
            <xsl:with-param name="text">
                <xsl:text>bad boys blue</xsl:text> 
            </xsl:with-param>
        </xsl:call-template>

Result: BAD BOYS BLUE

        <xsl:call-template name="LOWER">
            <xsl:with-param name="text">
                <xsl:text>BAD BOYS BLUE</xsl:text>
            </xsl:with-param>
        </xsl:call-template>

Result: bad boys blue

Here is the final XSLTFunctions.xsl file.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" /> 
    <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> 
    
    <xsl:template name="UPPER">
        <xsl:param name="text"/>
        <xsl:value-of select="translate($text, $smallcase, $uppercase)"/>
    </xsl:template>
    
    <xsl:template name="LOWER">
        <xsl:param name="text"/>
        <xsl:value-of select="translate($text, $uppercase, $smallcase)"/>
    </xsl:template>   
    
    <xsl:template name="FORMATBOOLEAN">
        <xsl:param name="BooleanChar"/>
        <xsl:variable name="BooleanCharUPPER">
            <xsl:call-template name="UPPER">
                <xsl:with-param name="text">
                    <xsl:value-of select="$BooleanChar"/>
                </xsl:with-param>
            </xsl:call-template>
        </xsl:variable>        
        <xsl:choose>             
            <xsl:when test="$BooleanCharUPPER='Y'">true</xsl:when>
            <xsl:when test="$BooleanCharUPPER='YES'">true</xsl:when>
            <xsl:when test="$BooleanCharUPPER='TRUE'">true</xsl:when>
            <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose>        
    </xsl:template>
   
</xsl:stylesheet>


Bad Boys Blue, are a eurodance group that came to fame around the same era as Modern Talking and Sandra back in the 80s, and like many of their contemporaries, their music evolved from the more traditional europop to a more upbeat eurodance style. Its hard to pick a favourite BBB track, but check out "You're a woman, i'm a man" for a little taste of their magic.

XSLT 1.0 include

A few years back, I ran a technical session for a client, on how to use XSLT to solve tricky Siebel problems and i came to realise that not every developer is exposed to XSLT.

On some projects XSLT is handled by the middleware team, and Siebel professionals just send across the raw Siebel Message for the external team to perform the transformations.

In a recent discussion with a new client, they wanted to upgrade to XSLT 2.0 to take advantage of include in XSLT to reduce the size of all their XSLTs. I advised them that it was not necessary to upgrade the XSLT engine for this reason, because this feature already exists in XSLT 1.0.

Keen readers of Impossible Siebel would know that the engine behind the EAI XSLT Service, which is used to transform all XML in Siebel, uses XSLT 1.0.

Casual implementors of XSLT might not know about the include statement, but this feature allows you to declare all your XSLT functions in a seperate file, and import it into the current stylesheet.

The following sample shows how to include an external file containing some XLST functions.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="XSLTfunctions.xslt"/>
</xsl:stylesheet>

<!--XSLTfunctions.xsl-->
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" /> 
    <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> 
    <xsl:template name="FORMATBOOLEAN">
        <xsl:param name="BooleanChar"/>
        <xsl:choose>             
            <xsl:when test="translate($BooleanChar, $smallcase, $uppercase)='Y'">true</xsl:when>
            <xsl:when test="translate($BooleanChar, $smallcase, $uppercase)='YES'">true</xsl:when>
            <xsl:when test="translate($BooleanChar, $smallcase, $uppercase)='TRUE'">true</xsl:when>
            <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>

In the above example, i've presented a function to ensure that booleans are formatted consistently, this can helpful if you have different source systems that have slightly different representations of booleans.

Since XSLT 1.0 dosnt have upper-case() and lower-case() functions, i used the translate function to perform this operation. The use of translate can be further refactored into a seperate function for speed.

Finally, here is how you would call these external included functions from your XSLT.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:include href="XSLTfunctions.xslt"/>
    
    <xsl:template match="/">
    <xsl:call-template name="FORMATBOOLEAN">
        <xsl:with-param name="BooleanChar">
            <xsl:text>y</xsl:text>
        </xsl:with-param>
    </xsl:call-template>
    </xsl:template >
</xsl:stylesheet>


Result: true

Using the "include" allows you to easily maintain all your XSLT functions in one place, it will reduce the size and clutter of your stylesheets, as well make it lighter and hence perform better, and maximise its re-usability.

In the next article, we'll look at how we can optimize the above function to perform better.