You need to sign in to do that
Don't have an account?
F Smoak
before delete trigger to prevent deleting a specific record type of an object
Hi,
I have a custom object A and record types A1,A2,A3
I want to write a before delete trigger and it's supporting test class so that it prevents deleting of A1 record type records but can delete A2,A3 record type records.
Please help!
I have a custom object A and record types A1,A2,A3
I want to write a before delete trigger and it's supporting test class so that it prevents deleting of A1 record type records but can delete A2,A3 record type records.
Please help!
It would be something like this :
I did try to use the above code and it is giving me validation error on A2 and A3 deletion whereas when I am deleting A1 records it gives me Insufficient privileges error.
Can you please help?
Just update the if condition to be
so when recordtype is equal to A1 , it will prevent, To sort out Insufficient privileges error check the following:
1. Record is accessible by you (In case Private sharring see if the record is shared with you)
2. See if the record type is accessible on your user's profile.
3. You have delete permission on A1.
I tried after updating IF condition and for sorting out privileges error below observations:
1. Record is accessible by you (In case Private sharring see if the record is shared with you) ----- Record is PRIVATE and user profile has CRUD access on Object
2. See if the record type is accessible on your user's profile.---- Yes, because the user creates the records and needs access to delete the same records.
3. You have delete permission on A1.--- A1 is record type is there some way to give delete permission on record type?
Please help!
Thanks,
FSmoak