flow designer - scripted wait for condition , wait for catalog task to be closed complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 05:36 AM - edited 04-17-2024 06:31 AM
Hi
I am trying to implement a scripted "wait for condition" that checks whether catalog tasks generated for a particular stage is "closed complete" before moving on to the next stage.
By stage I mean the below, do note that I am dynamically generating these tasks and stages (no hard coding). Do note that all tasks for each stage needs to be in "closed complete" before moving to the next stage. Tasks in each stage are generated in parallel.
stage 1: stage 2: stage 3:
catalog task 1 catalog task 3 catalog task 4
catalog task 2 catalog task 5
step 24: generates catalog tasks dynamically
step 25: after generating the catalog tasks for a stage, I check whether there are any tasks that are not in "closed complete".
step 26: If the number of records > 0 , means there are tasks not in "closed complete"
step 27: scripted wait for
This is my scripted wait for, I basically look for sc_tasks that belong to the RITM that are not "closed complete" and sets the answer = false to wait.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 07:18 AM
Then how are you creating the catalog tasks dynamically? How are they visually identified which dynamically created task is of stage 1 or 2 or 3?
And are the number of dynamically created tasks always the same? How does the number vary?
Its not hardcoding... its same as a workflow. In a workflow, you have to mention the stage while creating workflow activity. Only then the stage on RITM will be updated accordingly. Same here in the flow designer.
Sharad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 07:27 AM
Hi
The tasks are generated based on a lookup from a custom table
The table fields are
Catalog name, task name, task sequence
For example
Catalog A , task 1 , 0
Catalog A, task 2, 0
Catalog A, task 3, 1
Catalog A, task 4, 2
Catalog A, task 5, 2
So the sequence is the stage
Stage 0 - task 1, 2
Stage 1 - task 3
Stage 2 - task 4, 5
If there is more than one task in a stage, the task are generated in parallel.
And the stages can be from 0 to any number. That's why I mentioned that you were hard coding when you said "set max result..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 09:48 AM
@cnshum I have tried the scenario in my PDI,
var reqItem = fd_data.trigger.request_item.sys_id;
var gr = new GlideRecord("sc_task");
gr.addEncodedQuery("state!=3^request_item=" + reqItem);
gr.query();
gs.info("flow designer row count: " + gr.getRowCount());
if(gr.getRowCount() > 0){
return false;
}
else{
return true;
}
}
Log Result from my PDI,
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 09:35 PM
Hi
I get this error when I use your solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 11:15 PM
@cnshum Please check the last comment in this link.
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.