Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Monday, May 19, 2008

Siebel How To - enable or disable a button conditionally?

I was working on my desk one day and newbie to siebel approached me to ask a question(also a avid reader on asked me the same question on mail). He asked me about a simple requirement or rather I should say the requirement that appeared simple to me.

The requirement was :

A button on an Applet should be enabled if a particular user logs into the application otherwise it should remain disabled.The Solution is a simple script that we can write on Applet_PreCanInvoke event to enable or disable a button conditionally.

I am providing the pseudo code for that script below

function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if (MethodName == "UrButtonMethod")
{
if(UserLogin == "AuthorisedUser")
{
CanInvoke="TRUE";
return (CancelOperation);
}
else
{
CanInvoke="FALSE";
return (CancelOperation);
}
}
}

There is just one catch in the above mentioned code. How will you find that user is the authorised user or not. There are several ways of doing it some are easy and some are difficult.

I will tell you the easiest way to do that. You just need to write one line of code to accomplish that which is as following.

if(TheApplication().GetProfileAttr("Me.Login") == "AuthorisedUserLogin")

There is a whole bunch of such kind of profile attributes that are available to us all the time in the whole application, we can use them anywhere we want. But discussion on Profile Attributes is subject of another post. So, come back for more.

If this post was helpful to you, Please post your comments or suggestions to make this site better.

0 comments:

Featured Video