You need to sign in to do that
Don't have an account?
ForceLover
How can we make a trigger free from validation rule
I have a validation rule on lead object which is for our users to set them as owner for the lead.i written a trigger on task object to update the lead fields with task fields here i'm getting an error
activitycall2:execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 00QE000000ExKxvMAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION.
how can i make my trigger free form this validation rule through Apex.
Unfortunately, there is no straight way to avoid/bypass validation rules using Apex. However there are few workarounds. One of them is explained in this post
Hello,
Salesforce not provides any functionlity to avoid validation at the time of trigger execution except Lead conversion trigger.
You have require Inactive OR deactivate the validation, and write the manul validation( Validation logic) in your the trigger.
Click on KUDOS button if the post helps you!!!
If you find this as solution please marked as solution for others users help in a same query.
Thank You,
Raj Jha
Hi Raj,crmtech21
Actually this is my situation i have a validation rule on lead object for my users to take ownership, if user role is 'salesrep'.I'm writing a trigger on task object of lead to update lead fields i'm facing a tricky situation, in my sandbox i'm not getting any errors as i mention.I login as one of my user of salesrep role i'm able to create the task on a lead which is not owned by him(owned by queue), while updating leads i'm setting present login user as lead owner will it bypass the validation rule? But in production i'm getting the error ...!
Here is my trigger code...please go thriugh this and tell me the exact behaviour
Reply me ASAP...
Thanks for replying.As per Bob's post he has validation and trigger on same object here my situation is some what different hope you understand i have validation on lead object trigger on task object please guide me with the changes ..i really need this very urgent...