You need to sign in to do that
Don't have an account?

Trigger fails because of validation rule - workaround?
I have a trigger that updates 1 field on the opportunity that is a summary of several fields on a custom object that has a lookup relation. I cannot change this to a master-detail relationship, because the custom object needs exposure in the customer portal. The problem I am running into that there are several validation rules running on the opportunity that disallow saving. I cannot figure out how to get this field updated on the opportunity while leaving the validation rules in place. Any ideas? Its like I want to tell the valuation rule to ignore the rule if the update is due to the trigger.
Hi:
If you are updating an existing opportunity, and only updating one field, I don't see how a validation rule would keep you from updating the opportunity. What is the validation rule doing? Can you post your trigger code?
Well, the validation rule does not allow an opportunity to save if it meets the criteria below. I am totally at a loss as to how to work around this. The field that I update on the opportunity via the trigger has nothing to do with these validation rules. I have been messing around trying to see if I could write something in the validation rule that will allow everything to run and update the Cost field, even if the rule evaluates to True, but I don't think I have enough experience to figure this one out. Whatever the solution, it needs to work both from data loader and the user interface.
I really, really appreciate your help on this!!!
Error Message: Close Date must be in the FUTURE - Please change Close Date
Additionally, this validation rule is also causing the trigger to fail:
The trigger updates a Cost field on the opportunity, everytime a custom object Work Order is modified:
Those validation rules will fire when you do the update, and if the rules are new, or have been modified since the data was inserted, the opportunities may no longer pass the validation test. Here is a blog post that may give you some ideas on how to program around this issue. Basically you need to create a custom field to control your validation rules on the opportunity. http://nonprofitdata.org/2010/01/disable-validation-rules-by-record-in-salesforce/