Given the following code snippet, that is part of a custom controller for a Visualforce page:
In which two ways can the try/catch be enclosed to enforce object and field-level permissions and prevent the DML statement from being executed if the current logged-in user does not have the appropriate level of access? Choose 2 answers
A. Use if (Schema, sobjectType, Contact, isUpdatable ( ) )
B. Use if (Schema , sobjectType. Contact. Field, Is_Active_c. is Updateable ( ) )
C. Use if (Schema.sObjectType.Contact.isAccessible ( ) )
D. Use if (thisContact.Owner = = UserInfo.getuserId ( ) )
A. Use if (Schema, sobjectType, Contact, isUpdatable ( ) ) B. Use if (Schema , sobjectType. Contact. Field, Is_Active_c. is Updateable ( ) )
Explanation:
To enforce object and field-level permissions before DML:
A: Checks if the user has update access to the Contact object.
B: Checks if the user has update access to the Is_Active__c field.
Why Not Others?
C: is Accessible() checks read access, not update (required for DML).
D: Ownership check does not verify CRUD/FLS permissions.