- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 01:10 PM
I have a catalog item that when closed, creates a CI. This works off a Flow. In the catalog item, there is a variable of 1-5 named "Number of Accounts".
There was an ask to create a number of SCTASKs based on the answer to the Number of Accounts variable. For example, if the answer to the variable is 3, it creates 3 SCTASKs, and each SCTASK follows the rest of the Flow, creating a unique CI when closed.
I'm struggling to find a good way to loop the flow until the correct number of SCTASKs is created. Does anyone have a suggestion on the best way to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 02:04 PM
Hi @DylanB,
This article might help you: https://www.servicenow.com/community/developer-forum/flow-designer-do-the-following-until-loop-limit...
I did something similar based on counter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 02:04 PM
Hi @DylanB,
This article might help you: https://www.servicenow.com/community/developer-forum/flow-designer-do-the-following-until-loop-limit...
I did something similar based on counter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 06:48 AM
Hi Alex, thanks for the reply. I tried something similar on my PDI, but I'm having trouble getting it to increment the flow variable. I have the following steps set up.
On step 5, I scripted incrementing the flow variable with the following code. I'm not well versed in scripting so I'm not sure if this is the correct code. I found it on another post and changed the variable name.
In testing, the flow is getting stuck waiting on step 3 and 4. The first SCTASK is being created though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 06:59 AM
I figured out my issue now. The Create Catalog Task step had the Wait checkbox checked.
I unchecked that and it it ran through the rest of the flow correctly, except that it would create one less ticket than the catalog item variable choice. To fix that, I set the flow variable to 0 in step 2 and it worked correctly.