You need to sign in to do that
Don't have an account?
Override validation rule with trigger
Hello,
I have a validation rule right now that requires you to select a task type besides the default when creating a new task. I recently ran into a problem when our marketing automation tool tries to make a task in salesforce. On the marketing automation forum for creating a task it does not have the option of selecting a task type so it is set to default which does not comply with my validation rule. I wanted to know if I could write a trigger that would be able to set the task type before insert when you change the priority to something else besides the default so it will comply with the validation rule. Thanks.
Hi
you can use youre BEFORE TRIGGER solution since user defined validation rules run after before trigger:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm
All Answers
Validation rules currently execute before the "before" triggers (at least, they appear to do so), so that option is right out. But, you could instead write a trigger to perform the validation, which could include more complex logic. Or, you could modify your validation rule to ignore users of a certain profile or username (which would presumably be the profile or username of your incoming integration requests).
Hi
you can use youre BEFORE TRIGGER solution since user defined validation rules run after before trigger:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm
Could you help me adjust the validation rule below to exclude any task that has the priority set to "PQRS"? Thanks!
AND( ISNEW() , ISPICKVAL( Type , "None") )