Is it possible to make a report which would show the assignees of a bunch of Permission Sets ? I'm guessing the only way to do it would be to build a report based upon the PermissionSetAssignment object, but I don't think that's possible.

So is my only option Workbench?

  • 1
    Certainly not the only option. You can use the Query Editor, or roll your own CSV generator using Visualforce. There are many options available even if reporting is impossible. Is exporting the results a must have? – Adrian Larson Apr 19 '17 at 15:31
  • must have ? I hate to say Yes. Copy & Paste to spreadsheet would suffice. What is the benefit of Query Editor over Workbench ? – Zoom_v Apr 19 '17 at 15:36
  • Just that it's native. – Adrian Larson Apr 19 '17 at 15:38

No, it's obviously not your only option. It might be the simplest/most feasible, though.

That said, it wouldn't be incredibly complicated to run a script to email a CSV to yourself. Here's a simple POC:

List<String> rows = new List<String> { 'Username,PermissionSet.Name' };
for (PermissionSetAssignment assignment : [
    SELECT Assignee.Name, PermissionSet.Name
    FROM PermissionSetAssignment
]) rows.add(assignment.Assignee.Name + ',' + assignment.PermissionSet.Name);

List<Messaging.EmailFileAttachment> attachments = new List<Messaging.EmailFileAttachment>
    new Messaging.EmailFileAttachment()
attachments[0].setBody(Blob.valueOf(String.join(rows, '\n')));

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('Demo Permission CSV');
email.setPlainTextBody('See attached');
Messaging.sendEmail(new List<Messaging.Email> { email };

Of course you can make life even easier and pull this data using Data Loader.

| improve this answer | |

If you are on Windows, you should take a look at the power query plugin for excel.

You can dump a filtered set of permissionSetAssignment records to one table, the user object to another table, and do some simple vlookups to get the info you are after.

One click to refresh the data.

| improve this answer | |

When I run this in Developer Console "Execute Anonymous", I get an error, which is fixed if I just add 1 more line before the last sendEmail() line:

The last 3 lines need to be:

email.saveAsActivity=false; //<----- this line is missing in the code above
Messaging.sendEmail(new List<Messaging.Email> { email });

Once I added this, it worked great!

| improve this answer | |

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.