We have a Siebel 7.8 application, and a requirement to show a message when the user saves a record meeting certain conditions. Something like this:
function BusComp_WriteRecord () {
if (conditions) {
TheApplication().RaiseErrorText("Terribly important message");
}
}
The problem is that I can't use RaiseErrorText
because it prevents further events execution. That leaves me with either alert
or SWEAlert
(unless there is another option which I don't know of).
Both of them are supported only in browser scripts, and there is no browser version of the BusComp_WriteRecord
event. All this means that I have to keep my validations in the server script event, and somehow invoke a browser script function which shows the message. The only way I've come up with is something like this:
Server script (in the business component):
function BusComp_WriteRecord () {
if (conditions) {
TheApplication().SetProfileAttr("MyMessage", "Terribly important message");
}
}
Browser script (in an applet which is always loaded before the BC):
function Applet_Load () {
listenerAlert();
}
function listenerAlert () {
var message = TheApplication().GetProfileAttr("MyMessage");
if ((message != null) && (message != "")) {
TheApplication().SetProfileAttr("MyMessage", "");
alert(message);
}
// Keep checking for messages each 0,5 seconds, forever...
setTimeout("listenerAlert()", 500);
}
It does work, but it has an excessive impact on the servers performance. We have around 60 users per server, and apparently, checking a profile attribute twice a second for each user is too much (the CPU usage rises to 100%).
So, is there any other way to show an alert to the user in Siebel 7.8? It has to be an alert or similar, i.e. Siebel broadcasting messages are not an option.
Or, alternatively, if I have to stick with alert/SWEAlert: is there any other way to communicate between the server script and the browser script, without the endless polling?
If you still can use browser scripts, you can write the code at applet level. The applet has
function Applet_PreInvokeMethod (name, inputPropSet)
You can check for name=="WriteRecord" ,do your validations there, and pop the Alert() prompt.
Do let us know if it worked.