function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
raj161raj161 

Parent object updates causing an error.

Hi,

I am facing an issues with parent object updates.

 

When I try to update an opportunity then I am getting an error from the Account validation rule.

When I check the debug log...I see the Opportunity triggers, validation rules and workflow rules runs and the the Account triggers and Account validation rules are being executed.

 

I am not sure why the account triggers and account validation rules are being executed if I am updating an opportunity.

 

Thanks in advance.

 

Raj

shillyershillyer

Are you sure your account trigger or validation rule are not referencing an account roll-up summary field that aggregates data from the opportunity?

 

Best,

Sati

werewolfwerewolf
You may also have a trigger on Opportunity which is doing something to the parent account, and whatever it's doing is violating a validation rule.
raj161raj161

I don't have any work flow rule, validation rule or trigger based on the roll-up summary field.

I do have trigger on opportunity which is updating the opportunity itself but not the parent account.

 

I am not updating the parent account in any way.

 

Any other chances of occurrence of these errors???

werewolfwerewolf
Well evidently you do have something, either a trigger or rollup summary field, that is updating the parent account and triggering its validation rule.  The trigger would be on Opportunity, the rollup summary field would be on Account.  Look again.
raj161raj161

Yes, I do have couple of roll-up summary fields on account.  

But does the roll-up summary field update the account completely causing the Triggers and Validation rules to get fired?

 

I thought the roll-up summary field automatically gets updated with out causing validation rules and triggers to get fired.

 

Regarding the validation rules (or) triggers ON roll-up summary fields, I am not doing any such operations?

 

 

 

werewolfwerewolf
Yes, the rollup summary runs workflow and validation rules.  Check the rule that is firing to see what field(s) it's looking at -- if one of them is your summary field then there's your problem.
raj161raj161

I don't have the rollup summary fields used in any of the validations and workflows. I just have the rollup summaries of opportunity on account.

 

I do have the same structure in my sandbox but there only the opportunity rules and triggers run but not the account's. When I try to create an exact same scenario in sandbox and check the debug logs here I see only the Opportunity rules and triggers are getting fired but not account's.

 

Is there any chance this is being caused because of the automatic critical update which was done in December???

werewolfwerewolf

In a way, yes, it's possible because that update causes Opportunity to obey the normal workflow order.  However that doesn't mean that your validation rule is correct.  It just means that workflow is firing correctly now and your validation rule may not be expecting that.

 

Your validation rule on Account is firing.  It's referring to some fields on Account.  Some of them may be formula fields, but if you trace back the chain you'll very likely find that somewhere in there it's referring to one of your rollup summary fields.  Reverse engineer it to debug it.  Validation rules don't just fire because they feel like it -- this one is firing for a reason, and it's not that hard to identify.

 

You may also have a workflow on Account that is based on one of your rollup summary fields.  If a workflow field update does something a validation rule doesn't like, that will cause the validation rule to fire and invalidate the transaction.  So check your workflows on Account too.

 

It also may help for you to turn on Setup | Monitoring | Debug Logs and make this validation rule fire.  The log will give you a trace of what was going on when the validation rule fired.

raj161raj161

Thanks for your support.

I will debug for all workflow rules, validation rules and triggers to check the issue.

 

Will keep you posted about my findings.....

 

Thanks again for explaining...

 

Thanks

Raj