Disabling/Hiding Custom button in Query Mode


If we are using Edit List applet and configured Custom button on it then sometimes it needs to disable/hide on Query applet.
If it is not happening using any User Property then needs to write a Server/browser script on Applet.

Server Script
Note: Most of the times Server script is not working so need to write a Browser Script. Please refer Browser script section for it.

function WebApplet_PreInvokeMethod (MethodName)
{
switch(MethodName)
{
case “NewQuery”: //This is called when the query mode is invoked
TheApplication().SetProfileAttr(“CurrentAppletMode”,”QUERY”);
break;
case “RefineQuery”: //This is called when the query mode is invoked by CTR+R
TheApplication().SetProfileAttr(“CurrentAppletMode”,”QUERY”);
break;
case “UndoQuery”: // when these invoked applet leaves query mode
case “ExecuteQuery”:
TheApplication().SetProfileAttr(“CurrentAppletMode”,”NOTQUERY”);
break;
case “LPMSubmitButton”:
fnCreateNotification();
sReturn = CancelOperation;
break;
default:
break;
}

Browser Script: Most of the times Server script is not working so need to write a Browser Script.

Approach 1:

function Applet_InvokeMethod (name, inputPropSet)
{
switch(name)
{
case “NewQuery”: //This is called when the query mode is invoked
theApplication().SetProfileAttr(“CurrentAppletMode”,”QUERY”);
break;
case “RefineQuery”: //This is called when the query mode is invoked by CTR+R
theApplication().SetProfileAttr(“CurrentAppletMode”,”QUERY”);
break;
case “UndoQuery”: // when these invokde applet leaves query mode
case “ExecuteQuery”:
theApplication().SetProfileAttr(“CurrentAppletMode”,”NOTQUERY”);
break;
default:
break;
}
}

Approach 2: If Approach 1 is not work then we don’t have an option to hide a control on Query applet.
Note: This browser script sometimes not work if Applet has a record.

function Applet_InvokeMethod (name, inputPropSet)
{
if (name == “NewQuery”)
{
var controlVar = this.FindControl(“Assign To Me”);
controlVar.SetProperty(“Visible”, “false”);
}
else
{
var controlVar = this.FindControl(“Assign To Me”);
controlVar.SetProperty(“Visible”, “true”);
}
}

Approach 3: Combination of Applet Load and Applet PreInvoke event to enable and disable custom button.

Applet Load Event:
function Applet_Load ()
{
try
{
sNewApplet = theApplication().FindApplet(“Order Entry List Applet”);

//enabling View/Modify button
sActXCtrlViewModify = sNewApplet.FindActiveXControl(“EditRecord”);
sActXCtrlViewModify.style.visibility = “”;

}//end try

Applet PreInvoke Event
function Applet_PreInvokeMethod (name, inputPropSet)
{
switch(name)
{
case “NewQuery”:
case “RefineQuery”:

//hidding View/Modify button
sActXCtrlViewModify = sNewApplet.FindActiveXControl(“EditRecord”);
sActXCtrlViewModify.style.visibility = “hidden”;

break;

case “ExecuteQuery”:
case “UndoQuery”:

//enabling View/Modify button
sActXCtrlViewModify = sNewApplet.FindActiveXControl(“EditRecord”);
sActXCtrlViewModify.style.visibility = “”;

break;
default:
break;
}
}

Advertisements


Categories: Siebel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: