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
DeptonDepton 

Validation rule conflicts with after insert trigger : FIELD_CUSTOM_VALIDATION_EXCEPTION error

Hi guys,

 

Hi Guys, I have a after insert trigger on the Opportunity object to auto-update some fields.

via a VF page and a custom button it populates child opportunities.

 

I do have also a validation rule which based on Salesforce info it is supposed to be executed before the after insert trigger. But I am getting the following error

 

Update failed. First exception on row 0 with id 0063000000nF86gAq; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OpportunityAfter: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00k3000000K0Ra4ABF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please check!  Monthly Revenue is missing from some products: [] Trigger.OpportunityAfter: line 90, column 41: [] 

 Any idea on how to get only the validation rule error? or what to change/review on the trigger?

 

Thanks

 

Jia HuJia Hu
If you disable the Validation Rule, does the Trigger work as wanted?
and if you disable the Trigger, does the Validation Rule work as wanted?

If they both work separately, you have to check the logic when they work together.

BTW, how the 'Monthly Revenue' is used in your code?