2

I have below query which fetching the Active users from the permission set. But I need a count() of active users. Below is the query I am using :

SELECT Id, 
       AssigneeId,
       PermissionSet.Name 
 FROM PermissionSetAssignment 
 WHERE Assignee.isActive = false and permissionSet.Name='Test_Permission'
2
  • You need to count the records number of this query ? – SF_user Oct 13 '16 at 7:14
  • Yes.I need a count of records – sandy Oct 13 '16 at 7:18
1
SELECT count(Id) FROM PermissionSetAssignment WHERE Assignee.isActive = true and permissionSet.Name='Test_Permission'

If you want only the count, you can just use count(id) to get the count. But if you want other values you can go with the previous answer.

Thanks. Hope this helps!!

0

Here's the code :

List<PermissionSetAssignment> assignmentList = [SELECT Id, 
       AssigneeId,
       PermissionSet.Name 
 FROM PermissionSetAssignment 
 WHERE Assignee.isActive = false and permissionSet.Name='Test_Permission'];

Integer recordsNumber = assignmentList.size();

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.