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.


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



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



eg.3
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:

theApplication().SWEAlert("&");


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.


2 comments:

  1. Hi,


    I am calling workflow from browser script. The output of the workflow "ABC WORKLFOW" is Hierarchial ouput .


    var bo = theApplication().ActiveBusObject();
    var bc = bo.GetBusComp("Account");
    var sAccntId = bc.GetFieldValue("Id");

    var sWrkflow = theApplication().GetService("Workflow Process Manager");
    var SInputs = theApplication().NewPropertySet();
    var SOutputs = theApplication().NewPropertySet();


    SInputs.SetProperty("Object Id", sAccntId);
    SInputs.SetProperty("ProcessName", "ABC WORKFLOW");

    SOutputs = sWrkflow.InvokeMethod("RunProcess", SInputs);




    Although i could get the output of the workflow process manager business service in the above script, i got struck in retrieving the the output of "ABC Workflow" in the above browser script . I think i can call a server script from browser script and pass the values back to browser script. Could you please let me know if there is any way of retrieving the output of "ABC Workflow" within the browser script.

    thanks
    pradeep

    ReplyDelete
  2. Hi Pradeep,

    I havnt come across a situation where i need to do that in browser script. Is there a reason why you would want to do this?

    Browser script has a limitation on output propertysets
    http://download.oracle.com/docs/cd/B40099_02/books/OIRef/OIRefInterfaceRef171.html

    You cannot pass something from server to the browser. You can only set an attribute,fieldvalue and retrieve it from the browser, but you are limited to primitive types.

    ReplyDelete

Comments are open to all, please make it constructive.