Flow Designer not working as expected

Rocky5
Kilo Sage

Hello Experts,


We want to run a job everyday so, trying it via flow designer. where flow checks for all KB Articles that so so 'Business Valid to' date and for all the KB Articles found in lookup we should create 1 record and 2 tasks. So, I am using the below flow with 'For each item' in it so that for each KB article it creates 1 record and 2 tasks. 

But, the issue is.. lets say there are 5 KB articles found, this flow is not creating that 1 record and 2 tasks for all 5 KB articles at once instead it does one after one. But, for our use case we want that 1 record and 2 tasks be created for all 5 KB articles at once.. how can I do that? looks like 'For each item' isn't the right approach here.

Rocky5_0-1711138608395.png

 

Thanks,

Rocky.

 

9 REPLIES 9

Community Alums
Not applicable

Is it thinkable to add one or two fields to the parent entity? You could update that place once a sub task is finished, and then use a wait condition on the parent record. That way, you can decouple the task creation and the later steps.

Sanjiv,

 

I also tried to put wait for condition outside of For loop but looks like I cannot select the record in wait for condition since the record  I want to put in wait for condition is in For loop.

 

Thanks,

Rocky.

Community Alums
Not applicable

What if you trigger another Flow for that lifecycle thing, independently from creating the record? So in this one, you would simply create the record. Done.
The other Flow would get triggered on insert for each record separately.

-O-
Kilo Patron
Kilo Patron

You should consider using GlideAggregate to get the list of KB articles.

@Uncle Rob has a concise video about how to do it: Build a custom Flow Action to do Aggregation in #ServiceNow Flow Designer.

Probably function GROUP_CONCAT_DISTINCT will help you get the list you want - for details have a look at the docs: GlideAggregate.

Once you will have implemented a custom Flow Action to gather the KB article unique values (sys_ids), the rest should be str8 fwd.

Of course you could make the custom action a bit more generic and perhaps reuse it for other purposes.

Hey thanks for the shout-out