You need to sign in to do that
Don't have an account?
Vinnie Bacon 20
How do I get a trigger to run as a sys admin?
We don't do typical Lead conversion. Thus, I have a validation rule that applies to non-sys admins that prevents them from setting a Lead to a status of 'Converted'. That rule works fine and gives the user an error message telling them how they should convert a Lead.
Instead, if the user enters a specific field on the Lead, it is considered converted and I want to set the status to that. I have a trigger that sets the status and does some other things. However, even with the trigger it's the non-admin user doing the saving of the Lead and the validation rule kicks in.
Any ideas how to get around this? I tried a future method in the trigger but it seems to silently obey the validation rule.
Instead, if the user enters a specific field on the Lead, it is considered converted and I want to set the status to that. I have a trigger that sets the status and does some other things. However, even with the trigger it's the non-admin user doing the saving of the Lead and the validation rule kicks in.
Any ideas how to get around this? I tried a future method in the trigger but it seems to silently obey the validation rule.
I searched for the same and I found the below link can you please have a look at them once below are the links that I found.
>> https://salesforce.stackexchange.com/questions/106405/how-to-execute-and-run-a-trigger-as-a-system-administrator
>> https://salesforce.stackexchange.com/questions/10350/make-validation-rule-bypass-if-trigger-is-run/10353#10353
In case if this comes handy can you please choose this as the best answer so that it can be used by others in the future.
Regards,
Anutej