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
- Create two buttons that will invoke ShowPopup to display our different Popup applets.
- The above buttons will be made hidden
- 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: Button1 | Method Invoked: ShowPopup |
User Property Name | Value |
Mode | Query |
Popup | Popup Applet 1 |
Control Name: Button2 | Method Invoked: ShowPopup |
User Property Name | Value |
Mode | Query |
Popup | Popup 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.
Thanks a lot jason,
ReplyDeleteSorry couldn't reply ealier...
thanks again for such great info...
really useful
ReplyDeletegood one
ReplyDeletegood article
ReplyDeleteNice stuff!
ReplyDeleteOn Invoking method CloseApplet() on a custom popup applet Siebel hangs
ReplyDeleteHi Anon,
ReplyDeleteI'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.
Jason,
ReplyDeleteIs 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