+ Start a Discussion
satyamsatyam 

How to give access control to Custom button

Hi,

 

 

I created a custom button and i want that button should work for queue member only if anyone else is clicking that button then it should show alert message that you are not the member of queue. How i can implement this in custom button creation using javascript or anything else.

 

Thanks in Advance.

 

Thanks:))))

craigmhcraigmh

In the controller class, add a property and use that in your VisualForce like this:

 

public with sharing class YourController {
	public boolean CanClick { get; set; }

	public YourController() {
		CanClick = (logic to assign this variable);
	}
}

 

<apex:commandButton action="{!YourActionMethod}" value="Click me!" disabled="{!!CanClick}" />

 

SFRichSFRich

I would recommend you simply disable the button on initial display if the user is not a member of the queue rather than trying to display a message.  Start by looking at this thread: http://boards.developerforce.com/t5/General-Development/Getting-QUEUEMEMBERS-IN-QUEUE/m-p/253597/thread-id/52331/highlight/true  Put that SOQL code in your controller to determine if the user is a member of the queue and set a property called something like 'cmdBtnDisabled'  to true or false in the constructor.   public boolean cmdBtnDisabled {get; private set;}

Then in your Visual Force page, command button, add disabled ="{!cmdBtnDisabled}"  .  If the user is not a member of the queue, the button will be disabled.

 

 

 

 

satyamsatyam
Hi
satyamsatyam

Hi,

 

I am doing this in javascript.

 

I created a custom button based on execute javascript so for that i have to give access control so how i can do this?

 

 

Thanks:))))