Flow Designer Script to remove certain Items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 09:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 10:07 AM
Please share screenshots and what's your exact business requirement
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 10:08 AM
@Vasu2 It will be great if you share your question with little more details then only we will be able to help you.
Also, what have you tried from your side? What is technical blocker for you?
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 10:39 AM
Hello @Vasu2
Your code logic would be something to this
var res =;
var desc = fd_data.trigger.current.description.toString();
//assuming the record is the trigger and field is description feel free to update them
//test string '{"Rank 1":["user_id1"],"Rank 6":["user_id2"],"Rank 26":["user_id3"] }'
desc = JSON.parse(desc);
var hasRankGreaterThan25 = false;
var defaultUserID = 'YOUR_DEFAULT_USER_ID'; // Replace with the actual default user ID
for (var rankKey in desc) {
if (desc.hasOwnProperty(rankKey)) {
var tempAr = rankKey.split(' ');
if (tempAr.length > 1) {
var index1 = tempAr[1];
var index1Int = parseInt(index1);
if (index1 && !isNaN(index1Int)) {
if (index1Int < 25) {
res = res.concat(desc[rankKey]);
} else if (index1Int >= 25) {
hasRankGreaterThan25 = true;
}
}
}
}
}
// Remove duplicate user IDs
res = [...new Set(res)];
if (hasRankGreaterThan25) {
res.push(defaultUserID);
}
return res.join(',');
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 11:43 AM
Hi @Viraj Hudlikar ,
getting error in Line1 and also in this below line of code
res = [...new Set(res)];
Line 1 error