- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 07:10 PM
I am trying to write a script to check for any open change tasks and return true or false in Wait for Condition in flow designer.
But the Wait for Condition is showing error every time. Even if write a simple statement [return true] without any other code, the activity still shows error.
The subflow input is change request record and below is the Wait for condition to check for any open change tasks.
Please suggest if any idea?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2024 12:51 AM - edited ‎10-08-2024 01:40 AM
Hello @Anu2
The wait for condition script expects an encoded query as return value (for example "active=true^change_request=..."), not just the true false. I don't think wait for condition fits in your requirement.
Please ckarify your requirement, like you want to wait until all the change tasks are closed to continue further, OR just check if there is any open tasks or not and the continue accordingly. Based on your requirement I can provide a solution here.
If you want to wait until all the open tasks are closed, follow the screenshots below.
1. Sub flow with input type of Reference to Change Request
2. Create a flow variable.
3. Set flow variables - Check box unchecked - means False
4. Use a Do.. While loop
5. In the loop, have these actions.
Please let me know if you need any help 🙂
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 08:52 PM
Hi @Anu2
Below post could be helpful to you :
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2024 12:33 AM
The conditions mentioned in that post is not helpful as in my case there might be few change task which are created manually not only from flow, hence I need to query the change task table to see if any active tasks are left.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2024 01:15 AM
Hi @Anu2
You need to return the Wait for Action condition an encoded query so that the conditions could be evaluated. In the final return statement, try returning an encoded query like below example instead of true and false -
return 'active=true^number=CTASK0010002^state=3';
It will wait for the condition to be satisfied to continue.
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 08:55 PM
Hi @Anu2 ,
Please return true in if condition and in else block return false.
if(chg.next())
return true;
Please mark as helpful if my solution works and don't forget to hit thumbs up button!