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
Haystack CertifiedHaystack Certified 

Determining Live Agent User in VF or Apex

Is there a way to determine if a user has Live Agent permissions?  I tried {!$User.USERPERMISSIONSLIVEAGENTUSER} which is what Data Loader returned, but it didn't work in the VF page.  Could not find it in the API doc for User either.  Thanks.
Karthik PKarthik P
Hi,

Not sure whether you got the answer for this. But thought of replying although the question is couple of months old.

The one which you tried should work if you have queried the userpermissionsliveagentuser field in the VF page controller.

Below is sample code to check if the user is has live agent permissions or not.

VF Page:
------------
<apex:page controller="DetermineLiveAgentController">
    <apex:pageblock >
        <apex:pageBlockSection >
            <apex:pageBlockTable value="{!usersList}" var="user">
                <apex:column value="{!user.name}"/>
                <apex:column value="{!user.userpermissionsliveagentuser}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageblock>
</apex:page>

===============
Controller
===============
public class DetermineLiveAgentController {
    List<User> userList;
    public List<User> getUsersList() {
        userList = [ select id,name,userpermissionsliveagentuser from user ];
        if(userList != null){
            return userList;
        }
        return null;
    }
}
-------------------------------------

I have tested it and it works. 

Please mark this as answer if it has resolved your issue so that others may benefit.

Thanks,
Karthik