Release/Unrelease SmartScripts in batch
Jun/090
In the most recent release on the project I’m currently working on, the customer wanted to work with SmartScripts. Very soon we had over 40 SmartScripts.
The problem with SmartScripts however is that they all need to be released whenever they are created. And since the customer is working with 3 different languages, this means a lot of manual labour.
Therefore, I’ve come up with a simple but clever solution. I’ve added to extra buttons on the top applet called Unrelease All and Release All.

To (un)release all SmartScripts at once, the user simply has to query in the bottom applet for the correct language and click on the Unrelease All or Release all button. The script behind the buttons then performs the action for all SmartScripts for the specified language.
In the customer’s case, you have to perform this action 3 times (for languages ENU, NLD and FRA) in stead of around 100 times for each SmartScript individually.
Disable Print Preview menu item
Apr/070
We received the requirement to disable the Print Preview functionality in the entire application.
After searching a while, my colleague asked for help because he didn’t found anything on Supportweb about this and all his tries to disable it failed. Inactivating the Menu Item ‘File – Print Preview’ didn’t result in greying out the option from the menu. Even after deleting the cache of Internet Explorer, we could still do a Print Preview.
Searching Supportweb with the query “disable print preview” didn’t help us at all. Not a single SR was created with this problem. In the end I searched for “print preview” and finally I stumbled upon a piece of code that works. The code is actually very simple and is used on the PrintListService Business Service.
If you want to disable the Print Preview, use the following code in Server Script (eScript)
function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if(MethodName == “QuickPrintPreviewCustomAppletMenu”){
return(CancelOperation);
}
return (ContinueOperation);
}
This will disable the functionality in the entire application. It does not remove the menu item from the menu but just disables it (it becomes greyed out).
Removing trailing spaces in eScript
Feb/076
At the moment in Siebel, there is no trim function in eScript available to remove leading spacing in a string. In Vbscript, this function is available but not in eScript. A change request has been created to add this function to eScript.
After searching in supportweb, i came acros a piece of code provided by Siebel to replace the Ltrim() function. The code looked like this:
function trim(source)
{
var beginOfString = 0;
var endOfString = 0;for(var index = 0; index < source.length; index++)
{
if(source.charAt(index) != " ")
if(beginOfString == 0)
beginOfString = index;
else
endOfString = index;
}return(source.substring(beginOfString, endOfString + 1));
}
At first, it looked like the code did what it had to do, remove trailing spaces. But then I noticed that when there are no leading spaces, the code also removes the first letter in the string. Since this is unacceptable, I tried to wrote my own code and it turned out to be very simple.
My code looks like this:
function trim(source)
{
while(source.charAt(0) == ” “)
{
source = source.substring(1);
}
return(source);
}
Just a few lines of code but it does the work without removing letters if they are not spaces. Feel free to use the code whenever you need it.