41
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 ...
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 ...
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 ...
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 ...
13
votes
Accepted
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id: []
You can use userRecordAccess object to check CRUD permissions..
So pass the recordId and userId.. to check that user having what type of access on that record..
you can check variables like ...
11
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 ...
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
...
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 ...
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 ...
9
votes
Accepted
Managed Package Validation Error
Adam Torman's answer to a somewhat related (but not entirely) question notes:
We do intentionally block the setting of parent permissions if it's a standard object
By granting any access to a ...
9
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 ...
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 ...
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 ...
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 ...
8
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 ...
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 ...
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 ...
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 ...
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 ...
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 '%...
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 ...
7
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
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 ...
7
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 ...
6
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 ...
6
votes
Accepted
System Admin is API user only, no security token
Force.com IDE
Sometimes, you can still login with the Force.com IDE. It doesn't hurt to try. If you can, you can then download the admin profile, update the settings, and you'll be good to go. Make ...
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 ...
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 ...
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
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
permission-sets × 524permissions × 128
profile × 118
apex × 79
managed-package × 46
soql × 31
deployment × 20
security × 19
sharing × 19
user × 19
custom-permission × 19
field-level-security × 18
salesforcedx × 16
community × 15
metadata-api × 14
administration × 14
licenses × 12
user-management × 11
permission-set-groups × 11
visualforce × 10
unit-test × 10
metadata × 9
connected-apps × 9
isv × 9
custom-field × 8