Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
42 votes
Accepted

How can I assign a permission set to a user in a test context?

As suggested in a comment: PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = '<required permission set name>']; insert new ...
Patlatus's user avatar
  • 17k
32 votes

Salesforce bug enabled "Modify All"

You can easily check all of your profiles by clicking on "Your Name" > Developer Console > Query Editor, and using the following query: SELECT Profile.Name, PermissionSet.Label FROM PermissionSet ...
sfdcfox's user avatar
  • 493k
17 votes
Accepted

Exclusive differences Profiles vs permission sets?

As far as i know anything you can do w permission sets you can do w profiles, but there are a few things that can as of now only be done w profiles. The key UI difference in my experience is that only ...
16 votes

Exclusive differences Profiles vs permission sets?

What permission sets allow you to do is minimize the number of profiles that you have to create. It also allows you to temporarily add and remove permissions for users without needing to change their ...
crmprogdev's user avatar
16 votes

Salesforce bug enabled "Modify All"

From Salesforce Trust @ 5/17 12:56 pm: The Salesforce Technology team is investigating an issue impacting Salesforce customers who use Pardot, or have used Pardot in the past. The deployment of a ...
battery.cord's user avatar
  • 8,825
13 votes

How can I assign a permission set to a user in a test context?

In addition to @patiatus answer.... Should you need to setup a custom permission without needing to care about what permission set it belongs to .... // Given user User userWithCustomPermission = new ...
cropredy's user avatar
  • 71.7k
11 votes
Accepted

"Your account has been disabled" error message

I spend some time digging deep into why I could not assign a Permission Set to multiple users within my DE org (Developer Edition) to come to the realization that these users were inactive within the ...
TSmith's user avatar
  • 5,032
10 votes

Packaging system permissions in permission sets

As outlined in the documentation, you may only package the following permission set items: Custom object permissions External object permissions Custom field permissions Custom permissions ...
sfdcfox's user avatar
  • 493k
10 votes
Accepted

How to get list list of flows accessible by a User based on Permission Sets?

In short: I managed to do this in Apex by using apex-mdapi AFTER I updated the code to support flowAccesses. - here's the github commit with changes needed to support it. This is the only way I can ...
Kris Goncalves's user avatar
10 votes
Accepted

Spring 22 testmethod GACK when assigning a PermissionSet to a newly-created user

Fixed - This will be handled by Spring '22 Patch 4.6. Update: There is now a Known Issue - Test classes are failing with Salesforce Internal Server Error. The workaround listed is to update the ...
Kris Goncalves's user avatar
9 votes

How to resolve an "Unknown user permission: SendExternalEmailAvailable" deployment error

Set Email Deliverability to 'All Email': For unknown reason Salesforce automatically creates and removes this permission completely behind the scenes on all profiles based on the value of this ...
sskular's user avatar
  • 583
9 votes
Accepted

How to check which permission sets includes a edit permission on a field?

You can query for this in FieldPermissions: select parent.name from fieldpermissions where field = 'account.accountnumber' and permissionsedit = true and parent.isownedbyprofile = false
sfdcfox's user avatar
  • 493k
9 votes
Accepted

Deployment fails with: INVALID_CROSS_REFERENCE_KEY, You can only assign users to permission set groups that have the "Updated" status

Some observations If I login to the sandbox directly, and run all tests - they pass - no error Go to Setup and check the status of the Permission Set Group MyPSG - it is Updated I injected an assert ...
cropredy's user avatar
  • 71.7k
8 votes
Accepted

Query Object Access by Profile

Profiles are replicated into a special type of PermissionSet. IsOwnedByProfile will be true, ProfileId will be set to the Profile's Id field. So, you can query PermissionSet to determine a profile's ...
sfdcfox's user avatar
  • 493k
8 votes
Accepted

Permissions & Settings in Profile and Permission Set and its Usage

The Rule of thumb is permission set extend the access of profile and do not restrict. 1.In first scenario since profile already has access which means permission set cannot disable as permission sets ...
Mohith Shrivastava's user avatar
8 votes

How to resolve an "Unknown user permission: SendExternalEmailAvailable" deployment error

This relates to the "Send through External Email Services" setting in Setup. Go to Setup > Email Administration > Send through External Email Services to see the setting. According to the description ...
abd3721's user avatar
  • 2,162
8 votes

Salesforce bug enabled "Modify All"

As of 3 PM CDT. This is something I got to hear around from my colleagues who were part of the webinar that Salesforce had around this issue. The issue seemed to have affected DR sites as well, so ...
Jayant Das's user avatar
  • 30.6k
8 votes
Accepted

Can't assign permission set to my user after installing Salesforce Data Mask!

It was not really clear from the announcement or from most of the documentation, but Salesforce Data Mask is actually a paid feature, and if you want to use it you need to talk to your Account Execute ...
Renato Oliveira's user avatar
8 votes

Can we prove security using Apex Tests & System.runAs()?

I must admit, we have not attempted to revisit this side of things - our core managed package is too large and too mature. What I do know, from the few uses of System.runAs we have, is that this is ...
Phil W's user avatar
  • 36.6k
7 votes

Assigning permission set to user in apex

List<PermissionSetAssignment> permissionSetList = new List<PermissionSetAssignment>(); for (User u : [SELECT ID,UserRole.Name,Profile.Name,IsActive FROM User WHERE UserRole.Name LIKE '%...
phani dev's user avatar
7 votes
Accepted

How to know if a field is part of a compound address field and thus is not permissionable

There is an easy way to determine if field is a real field or a part of compound field. There are two tables in Salesforce which correspond to compound fields and its components. If a field can be ...
Patlatus's user avatar
  • 17k
7 votes

Get List of Permission set assigned to the user

Is there a requirement that you need all the Permission sets to be queried for some other use? Or else if its just to check why don't we directly use this query SELECT count(Id) FROM ...
Pintu Francis's user avatar
7 votes
Accepted

How is Permission Set Metadata Deployment changing in Summer '17 (API 40.0)?

By fully retrieving all permissions all the time, it will avoid the various Bad Things that happen when you only retrieve a partial package. This would lead to the XML file spuriously growing very ...
sfdcfox's user avatar
  • 493k
7 votes
Accepted

Get all field level permission from SOQL for an permission set

As mentioned by @benahm, SOQL on FieldPermissions retrieves only enabled field permissions for the permission set. Furthermore, as per chapter "Special Properties for Field Permissions" in ...
Shamina's user avatar
  • 4,275
6 votes
Accepted

Visualforce Tab Access?

I could find the VF tab in the Object Settings .Its confusing that Tab settings are mixed with Object Settings . My sample VF tab showed up Here is the Settings
Mohith Shrivastava's user avatar
6 votes

Exclusive differences Profiles vs permission sets?

In addition to Crmprogdev's answers and comments, this paragraph taken from here may be helpful: The key difference between the two is that the Profile is the users base set of permissions and ...
Andy Hitchings's user avatar
6 votes

Permission Set - Deciding correct components

You need to give access to visualforce page only. As per the docs: Once users can access a page, they can execute all Apex that’s associated with the page. This includes: The controller for the page ...
Mukesh Verma's user avatar
  • 1,916
6 votes

A good explanation for roles/profiles/permission sets and sharing

You can check this link http://hellosnl.blogspot.com/2017/08/salesforce-security-concepts.html Also check this image
nica's user avatar
  • 1,400
6 votes

Hide Field within Permission Set

Permission sets are not used to prevent access to fields, to do that go to the profiles for the relevant users and untick access on there. Then use the Permission Sets to give access to the other ...
Dave Humm's user avatar
  • 5,111
6 votes

Edit access to few fields in permission set

If you don't have Edit access at Object level then, only providing Edit access at FLS will not enable record for Edit. So, provide Edit access at Object at profile/permission set and then only ...
Santanu Boral's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible