Problem iterating "For Each" to create catalog tasks

dolsen1974
Tera Expert

Hello, ServiceNow community!

 

I have an MRVS that I'm I would like to iterate through to generate catalog tasks.  The problem is, it's only creating a task for row #1 in the MRVS.

 

I have a main flow and a sub-flow.  Doing the same action in the main flow works.  However, in the sub-flow, I'm only getting the first row created.

 

When I log out the results of the for each, I do indeed see both rows being rendered.

 

Does anyone have any thoughts on this?

1 ACCEPTED SOLUTION

This is actually a very good idea that I had not considered, trying it now.  Although I don't know why this would make any difference, it is very much worth a try.  Will report the results shortly

 

View solution in original post

9 REPLIES 9

Marco0o1
Tera Sage

Hi @dolsen1974 ,

 

Can you share more about your flow, how are you building your flow and the action if you are building it. For what i can look in the images is like in the for Each item you are iterating a object but you need to build and array to iterate on them when you build the array object in a action.

 

Hello and thank you SO much for your reply.  It is of type:  "Array.Object" and I am able to iterate it successfully and log out the results.  However, when I attempt to generate the catalog tasks, only the first task is created, and none of the subsequent tasks.  The flow is being built in Flow Designer.  There are no custom actions.  The process is working successfully in the main flow but is not working in the sub-flow.

Show us the flow please. If you debug in the "Flow Executions" you can also see what has been actually generated in each loop-iteration?

I suspect that you simply need to remove the "Wait" condition because the loop actually stops at the first iteration because OOTB the Action waits until the task is closed before further processing the flow (in this case this means the loop iteration stops until the task is closed).

MarkusKraus_0-1692733463769.png

 

Hi Markus and thank you for your reply!  Although I have fallen victim to this in the past, it is not the case here.  I have the "Wait" condition removed in all of my Create Catalog Task steps.  A very good idea though as it is often the culprit 🙂