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
Adu86Adu86 

Validation rules fires after updating field

Hi ,

I have two custom  fields and one roll up summary field to count child records on my Opportunity object Example: Field 1 , Field 2 and Roll up field. There is a validation rule created which fires  "when the count of Roll up summary field of child objects records are greater than Zero and when Field 1 value is changed", the error message says that "You cannot change the Field 1 value when Roll Up field value is greater >0".

The issue is we have an integration with third party system, they are trying to change Field 1 value and also Field 2 value together when Rollup summary is >0. There are recieving back the validation error message but Field 2 value is updated on opportunity record before the error is sent back to their system. 

When I tried same scenario from salesforce UI Interface, the valdiation fires without updating the value for Field 2 and record does not gets saved.

I am not sure why the Field2 value is udpated through API and validaiton rule is fired later.Can you please let me know if anyone has any idea about it.

Thanks
 
saikishorecareer3341.3947811933764766E12saikishorecareer3341.3947811933764766E12
Can you put your condition used for firing validation rule so tht we will get some idea on what is happening.
Amit Chaudhary 8Amit Chaudhary 8
If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.

 
William TranWilliam Tran
How is the third party updating the fields? are they utilizing triggers?

Usually validation rules fire before triggers, but it is possible that they use a before-event trigger to modify records while avoiding or before validation rules kick in.

When using the Salesforce UI, the validation rules are always enforced.