9

Due to recent security restrictions, our organization would like to remove the (very powerful) "Customize Application" permission from our operations users; however, these users actively manage our Queues for leads.

Does anyone know if it is possible to create a VisualForce / Apex Controller customization that would allow a user WITHOUT the "Customize Application" permission to manage Queue membership? Any help is greatly appreciated!

  • 1
    I'm pretty sure it's possible, let's poke FinancialForce guys, maybe they'll shed some secrets ;) @AndrewFawcett, @PhilHawthorn? From what I remember you won't be able to modify any non-setup object in same operation or you'll be slapped with MIXED_DML_OPERATION error. – eyescream Jan 6 '14 at 19:46
  • 2
    I'm fairly sure you can, one of our basic profiles doesn't have that enabled and its possible to do as a user with that profile (using our VF page). That being the case, can't see why you couldn't modify queue membership from your apex controller. – Phil Hawthorn Jan 6 '14 at 19:58
9

This seems to be possible. I just performed this simple test as a user without that permission without any problems, so if I understand the question correctly I think the answer is yes.

Page:

<apex:page controller="TestQueueMembership">

    <apex:messages />

    <apex:form >
        <apex:commandButton value="Test" action="{!toggle}"/>
    </apex:form>

</apex:page>

Controller:

public class TestQueueMembership
{
    public PageReference toggle()
    {
        List<GroupMember> groups = [select Id from GroupMember where Group.Type = 'Queue' and GroupId = '00Gb0000000RFBC' and UserOrGroupId = '005b0000000TPaL'];
        if( !groups.isEmpty() )
        {
            delete groups;        
            ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.INFO, 'Removed user from Queue') );
        }
        else
        {
            insert new GroupMember( GroupId = '00Gb0000000RFBC', UserOrGroupId = '005b0000000TPaL' ); 
            ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.INFO, 'Added user to Queue') );
        }

        return null;
    }
}
  • thanks Phil - this is fantastic! I appreciate you including some sample code as well to get us started. If you have code in the way of replicating the "Available" vs. "Selected" multi-select boxes that would be GREAT! – Joe P Jan 8 '14 at 17:36
  • I don't I'm afraid, you can query the GroupMember object where Group.Type = 'Queue' for available and then the query I supplied above to get Selected – Phil Hawthorn Jan 8 '14 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.