Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Flow Designer - If Action comparison of reference fields not working

Jeff77
Tera Guru

I have a (IMO) fairly simple If action comparison that doesn't seem to be working.  It is basically checking to see if a catalog variable is not empty, and if it is unequal to another catalog variable.  The catalog variables are both reference fields to sys_user table. 

The logic is essentially checking to see if the person that submitted a request is the budget manager of their department.  If the submitter is not the budget manager, then it branches one way, where the approval step is assigned to the budget manager, however if the submitter is the budget manager it branches another way to a central payroll team for review/approval.   Below is the If action condition set..

Jeff77_1-1760109805675.png

 

But it does not seem to work.  Below is a screenshot of a submission from a budget manager that somehow evaluated to true.  

Jeff77_0-1760108388517.png

Hard to see but if you expand you can see the compared values (text copied to below): 

fbf429473b5a6e1027bff2c964e45ae4ISNOTEMPTY^fbf429473b5a6e1027bff2c964e45ae4!=fbf429473b5a6e1027bff2c964e45ae4 


So I guess my question is, can one not compare 2 reference fields of the same table in an If action, or is this a bug? 
Edit: Forgot to mention, we are on Yokohama.  This has occurred in our prod instance (Patch4b) and non-prod (patch7 hotfix2)

1 ACCEPTED SOLUTION

Jeff77
Tera Guru

Thanks to everyone that replied.  I adjusted the flow to dot-walk to the sys_id of user record in sys_user instead of comparing the reference field itself and it works as expected this way.  

View solution in original post

5 REPLIES 5

M Iftikhar
Tera Sage

Hi @Jeff77,

 

Please check you don't have any extra space after the data pill, because even an extra space can cause the condition to evaluate true.

MIftikhar_0-1760116148199.png

 

If my response helped, please mark it as the accepted solution so others can benefit as well.

 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

Hello @Jeff77,
I see that you’ve marked my solution as helpful. If it worked for you, please mark it as the accepted solution so it can help others in the future as well.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

nityabans27
Kilo Patron

Hi @Jeff77,

Flow Designer can’t reliably compare two reference-type catalog variables directly — it sometimes treats them as text, not sys_id, so your “If” condition gives wrong results.

Fix:
Use a Script step (or a Record Lookup) to compare the two users by their sys_id, then branch on that boolean result.
This is a known Yokohama bug, seen even in Patch 7 HF2.

Ankur Bawiskar
Tera Patron
Tera Patron

@Jeff77 

Could be a bug. better to create flow variables of type String to store both the variable values

then use "Set Flow Variables" flow logic to store the values

Then use IF flow logic to do the comparison.

💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader