You need to sign in to do that
Don't have an account?
trigger to prevent deletion for opportunity products
Hi,
I'm an admin and I'd like to create something to prevent non-SysAdmin users from deleting opportunity products. The only option I'm seeing for this is creating a trigger...which I've never done. I copied and pasted the below from something and am trying to swap things out, but I'm not sure what to plug in. What should "Account acc" be for opportunity product? How do I prevent this from being applied to admins? Do I only need the trigger to get this to work?
trigger <PreventOpportunityProductDeletion> on OpportunityLineItem (<events>) {
for(Account acc : trigger.old){
acc.adderror('Account Cannot be deleted');
}
}
Thanks in advance for your help!
Please try this one. This trigger will not allow anyone to delete OpportunityLineItem except Admin profile.
Hope this helps.
Thanks
Arvind Singh