- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 07:26 PM - edited 09-27-2023 07:26 PM
Hi All,
I have below requirement:
All Tasks are Closed Complete – RITM and Request Closed Complete.
All Tasks are Closed Incomplete – RITM and Request Closed Incomplete.
All Tasks are Closed Skipped – RITM and Request Closed Skipped.
If it is a mix, then:
If any are Closed Complete, then RITM and Request Closed Complete
Else RITM and Request Closed Incomplete
I tried to do with Flow designer but it is updating only one state i.e Closed Complete
Please help me in the above logics in FD or with any script.
Thanks,
Samiksha
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 11:20 PM
@Samiksha2 create another variable called "anyClosed" and in the for each step add an if condition, if task status is closed complete set anyClosed variable to true.
Then after the for loop your conditions will be like below,
if - anyClosed :: is :: true -- Set the status to Closed Complete
else if - first variable :: is :: closed complete -- Set the status to Closed Complete
else if - first variable :: is :: closed Incomplete -- Set the status to Closed Incomplete
else if- first variable :: is :: closed skipped -- Set the status to Closed Skipped
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 06:32 PM
hello can you show us how you build it as I am trying to put in a similar solution and it would be great to see an example of you -- if ---Else if
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 11:20 PM
I will suggest to use BR here instead of flow because of different scenarios.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 01:11 AM
Hi @Ankur Bawiskar ,
I firstly tried with BR but I was unable to do the below condition:
If it is a mix, then:
If any are Closed Complete, then RITM and Request Closed Complete
Else RITM and Request Closed Incomplete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 12:49 PM
Hey, how would you write this as a Business Rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 10:35 PM
Hi @elphilli ,
BR on sc_task table. After update. Condition- state changes
var sct = new GlideRecord('sc_task');
sct.addQuery('request_item', current.request_item);
sct.query();
var totalCount = sct.getRowCount();
var sct1 = new GlideRecord('sc_task');
sct1.addQuery('state','4');// change task state according to your requirement
sct1.addQuery('request_item', current.request_item);
sct1.query();
var completedtotalcount = sct1.getRowCount();
if (totalCount == completedtotalcount) {
var ritm = current.request_item.getRefRecord();
var req = current.request.getRefRecord();
ritm.state = 4;//change ritm state according to your requirement
ritm.stage="closed_incomplete";
req= 7;//change request state according to your requirement
ritm.update();
}
Thanks,
Samiksha