flow designer for each loop, how to add logic to close Request?

Khalnayak
Tera Guru

Hello,

 

I have a for each loop to add users to AD group, and that works fine.

However, I need to add logic to the flow, so the request is closed if users are added to ad group successfully.

It does not have to be all the users from list collector, but as  long as some are added I want the request to be closed complete.

Now if i add the if logic to check if status was success within the for each loop then it will change the state of the request for each user it adds?

see my flow below, where I have moved the if step and update record step out of the for each loop...

find_real_file.png

, but here also it does not work. as the runtime value does not equate to success, but equates to {0}??? im not sure why this is, maybe because I am checking outside the for each loop? 

 

find_real_file.png

 

ccan someone provide a suitable solution here please?

14 REPLIES 14

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

what is that step 24 which will give you Success

Can you share that test step image

Regards
Ankur

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

Hi @Ankur Bawiskar the step 24 basically adds user to group.

I need a way to check if atleast one of the for each iteration for adding user to group has been successful and then close complete based on that, otherwise close incomplete

find_real_file.png

find_real_file.png

Hi,

I believe you cannot access output of step 24 outside for each as it's context is within for each only

Possibly you will have to use some flag to hold the value when success set it with true

then check for this flag outside for each

Regards
Ankur

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

Thanks @Ankur Bawiskar can you provide an example? as i wont know how use flag

thanks in advance.

Starting in Quebec a scratchpad has been implemented for flows in the flow designer. You should be able to use that to carry the value to step 24.

See documentation on flow variables here for details.