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 is failing because it is not returning value for if statement

Daniel Jones
Tera Contributor

Hi all,

 

I have created a flow using Flow Designer, which uses the Active Directory Spoke v2 integration with Integration Hub.

 

I am attempting to do an if statement off the back of one of the actions used named "Is User in Group" which checks if the user is in an active directory group. These groups do not exist in ServiceNow. This seems to return true/false, but the if statement that follows afterwards on a rare occasion seems to be getting the reference to this value rather than the value itself, which is causing the flow to error.

I have added a 30 second timer inbetween the action and if statement to see if this would fix it, or to see if it was caused by not having enough time (although I don't think this should be the case) but it is still happening.

 

And you can see the previous step has returned the correct value:

DanielJones_2-1761032544783.png


But the if statement seems to return a reference to the context instead of the value:
DanielJones_0-1761032424388.png


Any help would be greatly appreciated.

4 REPLIES 4

vignesh parthib
Tera Guru

Hi @Daniel Jones 

 

Can you refer the below refence link for User in Group functionality 

See if a user is in a group in flow designer (a quick tutorial) 

Need to check user is part of group in Flow Designer 

 

Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."

Hi Vignesh,

I'm querying if the user is in a group in Active Directory, not in ServiceNow. The groups are not in ServiceNow so I am using the AD v2 Spoke to check if the user exists already in the AD group before trying to add them to the AD group.

If I don't do this, the flow will attempt to add them and it will be successful regardless of whether or not they are in the group. For a better user experience, I want to be able to see if they are in the group already.

 

**I've updated the post to clarify.

Bhuvan
Giga Patron

@Daniel Jones 

 

Make sure you are looking up using correct fields, refer below knowledge article for more details

 

https://noderegister.service-now.com/kb?id=kb_article_view&sysparm_article=KB0869590

 

If it does not work, share your Flow steps and execution logs. If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

Hi Bhuvan,

 

I didn't include the users ad sam account in the screenshot, but this was used and you can see that it returned the value false. In the next step it didn't use this value and instead referenced it.

Dan