Release/Unrelease SmartScripts in batch

9
Jun/09
0

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.

VN:F [1.8.2_1042]
Rating: 5.0/5 (1 vote cast)
VN:F [1.8.2_1042]
Rating: 0 (from 0 votes)
Tagged as: ,
239 views

RaiseError()

2
Oct/08
1

A while ago I discovered the function RaiseError() in Siebel. To be honest, a colleague said that I could use that function in stead of RaiseErrorText().

Since we are implementing a multi-lingual application, all error messages should be multi-lingual. So whenever we wanted to throw an error message in eScript, we used the following code combining RaiseErrorText and LookupMessage in order to throw the error in the correct language.

TheApplication().RaiseErrorText(TheApplication().LookupMessage(“User Defined Errors”, “X_DISPATCH_REQUIRED_FIELDS”));

As you can see, this requires a lot of typing and this was also the opinion of a colleague. He then suggested me to use the RaiseError function instead. This is actually the same, but you just have to pass the name of the error you want to throw as an argument.

TheApplication().RaiseError(“X_BARCODE_NOT_NUMERIC”);

Off course you have to create the error message first in Tools in Message Category -> User Defined Errors and not in User Defined Strings as I tried.

The RaiseError function saves you time on typing code, so be sure to use it next time you want to throw an error in you script when running a multi lingual application.

VN:F [1.8.2_1042]
Rating: 4.0/5 (2 votes cast)
VN:F [1.8.2_1042]
Rating: +1 (from 1 vote)

Disable Print Preview menu item

25
Apr/07
0

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

VN:F [1.8.2_1042]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.2_1042]
Rating: 0 (from 0 votes)
Filed under: eScript
1,021 views

Removing trailing spaces in eScript

26
Feb/07
6

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.

VN:F [1.8.2_1042]
Rating: 3.0/5 (1 vote cast)
VN:F [1.8.2_1042]
Rating: 0 (from 0 votes)
Filed under: Siebel behaviour, eScript
1,493 views