Posts

Showing posts with the label insert

Salesforce Fact #656 | Inserting data into SetupEntityAccess

Similar to retrieving data, we can insert rows using apex as well in SetupEntityAccess object for custom permission. Example code: SetupEntityAccess sea = new SetupEntityAccess(); sea.ParentId='0PS6F0000057tXt'; // this is the permission set Id sea.SetupEntityId='0CP6F000000XkviWAC'; // this is the custom permission Id insert sea; Note: If an attempt is made to insert row for an already existing combination, the error 'DUPLICATE_VALUE, duplicate value found:' is shown.