You need to sign in to do that
Don't have an account?
Adhvika Bala
Apex trigger for the contact to be deleted only by owner
1 2 3 4 5 6 7 8 9 10 11 12 13 | trigger Contactdel on Contact(before delete) { if(trigger.isbefore && trigger.isdelete) { for(Contact t: trigger.old) { if(UserInfo.getUserId() != t.ownerid){t.addError('Permission Denied, Please Contact the System Administrator');}} } } Have this above apex trigger so the users can delete the contacts that are only owned by them. However an user is trying to Merge two contacts. And he is getting an error message. "Permission Denied" How do we adjust the code so this code bypass for certain users(System administrators). Thank you! |
How about adding conditon for Profile Name
reference:
https://salesforce.stackexchange.com/questions/262393/add-check-of-user-profile-to-a-trigger
If it helps, Please mark it as best Answer.
Thanks!
- a flag on user object and include it in condition
or
- add id's in static resource and custom object and include it in condition