Monday, June 20, 2011

3 buttons with same method as “Show Popup” for showing popup applets

This Req/Solution i got it from Karthik . Thanks Karthik

Issue: We have 3 buttons with same method as “Show Popup” for showing popup applets, but the buttons need to enable/disable based on the conditions. It would be difficult to enable/disable button as the all buttons are sharing the same method name.

Solution:

Inputs taken from another Siebel blog.

Give different method names for 3 buttons.

Alternative way to invoke the show popup using browser script

Write the below Browser script to invoke the “Show popup” method, when the button is clicked.

function Applet_PreInvokeMethod (name, inputPropSet)

{

// code to enable the buttons as show popup

try

{

if(name == "XXX" || name == "YYY" || name == "ZZZ")

{

inputPropSet.SetProperty("SWEMethod","ShowPopup");

this.InvokeMethod("ShowPopup",inputPropSet);

return("CancelOperation");

}

}

}

Write the server script in Pre Can Invoke method as usual to disable/enable button based on conditions.

function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)

{

try

{

var pstntype = TheApplication().GetProfileAttr("Primary Position Type");

if((MethodName == "XXX" || MethodName == "YYY") && (pstntype == "CCC" || pstntype == "DDD"))

{

CanInvoke = "FALSE";

return(CancelOperation);

}

else

{

CanInvoke = "TRUE";

return(CancelOperation);

}

}

catch(e)

{

TheApplication().RaiseErrorText(e.tostring());

}

finally

{

pstntype = null;

}s

return (ContinueOperation);

}

2 comments:

  1. Amazing Post Joseph Thomas... I was stuck with the same problem and you made it look like a moon walk(smooth). Keep doing the good work !!! Cheers

    Regards,
    AJ

    ReplyDelete
  2. thank you so much!!!
    I've been looking for this solution all day :D

    ReplyDelete