Using "Do the following in parallel" into a loop "do the following until"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
Hi,
I try to do a loo where i want to execute one action if a sc_task is updated OR if 2 minutes is passed
but repeat 5 times.
When le loop is executed one time and passed on one branch of the "do the following in parallel" it not wait a second time in the branch where the wait.
I think when used a "Do the following in parallel" it's only execute one time the branch, not execute a second time.
But need to find solution to loop until a task is updated or 2 minutes passed and execute the "wait 2 minutes" only 5 times.
Regards,
Cédric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hi @CKJ-BeOS ,
I create a sample script for you please check
var taskSysId = '46c5cd93938932d09305f520ed03d60a'; // your sc_task sys_id
var maxAttempts = 5;
var intervalMs = 2 * 60 * 1000; // 2 minutes in milliseconds
var updated = false;
for (var i = 0; i < maxAttempts; i++) {
var task = new GlideRecord('sc_task');
if (task.get(taskSysId)) {
if (task.state == 3 || task.u_your_field == 'done') { // your sample condition
gs.info('Task updated - exiting loop.');
updated = true;
break;
}
}
gs.info('Attempt ' + (i + 1) + ': not updated, waiting 2 minutes');
gs.sleep(intervalMs);
}
if (!updated) {
gs.info('Task not updated after 5 attempts (10 minutes total).');
}
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
hi @Sarthak Kashyap,
thanks, but i would like to do without scripting if possible, only using Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
@Ankur Bawiskar @Sarthak Kashyap
finally i find a solution by using Two subflkow
the first contain a Loop waiting the task is closed
the second contain only a Parallel executing :
- a wait on update task
- 2 minutes
i put here my two sublow need to obtain result
