From reading the phrasing of your question and then seeing your formula code, I believe I have some thoughts on how to resolve your issue.
checks if a parent account is present, has been changed and checks if a parent field contains a certain value.
Your formula below as written, doesn't do what you describe above sequentially:
AND(
NOT(ISBLANK([Account].ParentId)),
ISCHANGED([Account].ParentId),
ISPICKVAL([Account].Parent.referenceField__c, "Strategic")
)
What the above does is an All or Nothing test. It's a Boolean Result. If any of the above are false, the test fails. However, unlike much of Apex, in a formula, all tests have to execute for the formula to complete. You're not first testing to see if the ParentId
is ISBLANK
before the code decides whether to test to see if the ParentId ISCHANGED
and then decides to test if the referenceField__c
picklist value is equal to "Strategic"
.
If that's what you want, you need to "nest" your formulas or "sequence" them by inserting decision trees in your flow with exit branches. Exactly how depends on the answer to this question: Are there different directions your flow would take if one of the above were false and the others were true?
Clearly if there's no parent, there's no Parent.referenceField__c
that can be assigned to the equivalent field on the Account record
your flow is working with. To me, that sounds exactly like what the error message is saying. In essence, if there's no parent, your flow can't process the record any further and you need to discard it from the list of records you've collected for further processing in your flow.
Its either that or you need to send those records at your decision tree in another direction that processes them differently than the records that pass the test. I don't know the details of your flow and it's not clear to me at what point the parentId is being removed from the record (or it's a case of needing to screen for records that may not even have a parentId).
If you're removing the parentId within your flow, you may be populating a variable with the look-up to the parentId and the related field. When the parentId disappears, you lose the context for the lookup to the related field. At that point, the flow doesn't know what to do with the orphaned field once that lookup is removed that it was using to provide that reference.
This could be a case of where you need to assign the value by reference rather than as a lookup to the parent record in order to solve the issue you're having which admittedly, is not an ideal solution. Either that, or you'd need to remove the reference to the field first before removing the look-up. I don't have enough information to guide you further, but clearly that's what it's searching for and your process needs to direct these records around that part of your code if they don't have the look-up available.