2

I am using an object from a third party package, we'll call it xyz__Obj__c, that has several fields, let's call them xyz__A__c, xyz__B__c and xyz__C__c, that are percentages. The package then has a formula field, let's call it xyz__Total__c that is the sum of these percentages (with a simple xyz__A__c + xyz__B__c + xyz__C__c). This total must equal 100, which is checked in the third party package using a validation rule against xyz__Total__c.

In our use case we don't care about these fields and wanted to create a simple autolaunched flow that, on creation of an xyz__Obj__c record, simply sets the field xyz__A__c value to the literal 100.

Unfortunately, it seems that field updates in flows don't cause re-evaluation of formula fields in the same record. I say this because the validation rule against xyz__Total__c is being violated and we get the validation rule's message presented when trying to save a record created through the Salesforce UI.

We have tried:

  • a flow: the validation rule is violated
  • a process builder flow: the validation rule is violated
  • a trigger: all is fine

According to the official documentation, flows are processed before triggers...

Anyone seen this before? If so, did you find a non-trigger solution? (The nice thing about flow-based automation is that even when packaged they can still be disabled on a subscriber org if a customer needs to do something different.)

  • What if you explicitly set the B and C fields to zero? – David Cheng Jun 29 at 18:24
  • Thanks @DavidCheng, I'll give it a go, though whilst these fields don't have default values I can successfully save the record if I manually set just this one field to 100 through the form before saving the new record. – Phil W Jun 29 at 18:41
  • yes it seems unlikely that zero will make a difference. You say you're using an auto-launched Flow - what happens if instead you use a process builder to set field A on creation? – David Cheng Jun 29 at 18:57
  • @DavidCheng explicitly setting zero for the other fields didn't change anything. As to using process builder, just trying out that suggestion. – Phil W Jun 29 at 19:26
  • @DavidCheng process builder suffers the same issue here. – Phil W Jun 29 at 19:41
1

It turned out to be a logic issue in the flow, before the assignment, that did not cause an error to be shown but prevented the assignment happening. Once fixed we found that the flow's change to the field was reflected correctly in the formula field used in the validation rule.

Still, not sure why the process builder variant didn't work since this used an "always" condition and a straight forward setting of a field value.

The learning points were:

  • flow changes to fields do get reflected in formulae
  • flow error handling isn't very good
  • debugging flows on record creation doesn't really work
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.