Display different Popup applets from a single button click

The frequency of articles on Impossible Siebel has slowed down due to current project responsibilities, but i'd thought i say a quick hello by responding to a reader question.

This article has been requested by our good friend Neel, over at Siebel Unleashed.

Requirement

Display a different popup applet on the same button click depending on certain conditions.

Solution Overview

  1. Create two buttons that will invoke ShowPopup to display our different Popup applets.
  2. The above buttons will be made hidden
  3. Create a master button that will programically click the desired hidden button to display our desired applet


Implementation

Configure two buttons as follows









Control Name: Button1Method Invoked: ShowPopup
User Property NameValue
ModeQuery
PopupPopup Applet 1
Control Name: Button2Method Invoked: ShowPopup
User Property NameValue
ModeQuery
PopupPopup Applet 2


Configure a master button that invokes a custom method and click the above buttons based on a profile attribute.

The following code should be put behind PreInvokeMethod on the applet in browser script


var retOperation = "ContinueOperation";
switch(name)
{
case "EventMethodTest":
retOperation = "CancelOperation";
var oAppl = theApplication().FindApplet("My Applet");

if(theApplication().GetProfileAttr("WhichButton") == "Button1") {
var oCon = oAppl.FindActiveXControl("Button1");
}else{
var oCon = oAppl.FindActiveXControl("Button2");
}
oCon.all[0].all[0].click();
break;
}
return (retOperation);


Once you are happy with the above config, you can make the two ShowPopup buttons hidden.

There are various ways of doing this, you can make the buttons hidden using browser script on applet load.

var ctrl = this.FindActiveXControl("Button1");
ctrl.style.visibility="hidden";
var ctrl = this.FindActiveXControl("Button2");
ctrl.style.visibility="hidden";


Another way is to provide ON and OFF states for the button, and assign it a blank image. Maybe our readers know of better ways to do this, i'll leave this open for comments.


Reactions:

8 comments:

  1. Thanks a lot jason,

    Sorry couldn't reply ealier...

    thanks again for such great info...

    ReplyDelete
  2. On Invoking method CloseApplet() on a custom popup applet Siebel hangs

    ReplyDelete
  3. Hi Anon,

    I've used CloseApplet on custom popup applets with no issue. You'll need to check your logs to see whats causing the crash in your case.

    ReplyDelete
  4. Jason,
    Is there a way to open up a pop up or just a Yes and no dialogue box when a field value changes.. Here we do not have any button at all..

    Thanks,
    Poonam

    ReplyDelete

Comments are open to all, please make it constructive.