function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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:))))

Suresh RaghuramSuresh Raghuram

write a if condition to check weather the person clicking the button is a member or not

PhoenixedPhoenixed

Hi Satyam,

 

Make the custom button as execute java script.  And in the button use AJAX to query the queue where Memberid = logged in user id. If it is found alow the user else, give the alert message.

 

 

Thanks,

Phoenixed.

satyamsatyam
Hi,
satyamsatyam

Hi,

 

I have written below code for this

 

Queueid=[Select Id from Group where type='Queue' and Name='Reg_Service_Queue'];

Selecteduser=[Select UserOrGroupId From GroupMember where GroupId =:Queueid];

if(Selecteduser == UserInfo.getUserId())
{
alert('Yes');
}
else
{
alert('No');
}

 

but its  showing an error that

 

A problem with the OnClick JavaScript for this button or link was encountered:

missing ] after element list

 

what is the solution of this problem.

 

Thanks:))))

Suresh RaghuramSuresh Raghuram

can u post ur javascript code