Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// .... //
myObject__c myObject = new myObject__c();
myObject.field1__c = 'abc';
myObject.field2__c = 'def';
List<String> objFields = new List<String> {'field1__c', 'field2__c'}
// helper class uses describe information to retrieve object permissions
apo_SecurityHelper securityCheck = new apo_SecurityHelper();
if(securityCheck.isAuthorizedToCreate(myObject__c.SObjectType, objFields) {
insert myObject;
} else {
// raise exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment