- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
We have a Business Rule that changes the HR Case state from Suspended to Work in Progress (WIP).
Currently, the Business Rule runs when:
The State is Suspended
The Opened for or Subject person is Dynamic – Me
Additional comments field changes
This works fine for our current use case.
Now, we have a new requirement:
If any user from the Watch list adds Additional Comments while the case is in the Suspended state, the case should automatically move to Work in Progress.
However, if an HR Agent adds additional comments, the state should not change.
Since we can’t use the condition “Additional comments changes” directly on the Business Rule (because it triggers irrespective of who made the comment), how can we configure or script this logic properly?
Thanks,
Gokul
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
what's your actual business requirement?
earlier logic is working fine, now you just want to add 2 extra things
simply check these 2 things in filter condition
then use this script to further check
-> if logged in user is opened for OR logged in user is subject person OR logged in user is present in watch list AND Assigned to != Logged In user
(function executeRule(current, previous /*null when async*/) {
var openedFor = current.opened_for;
var subjectPerson = current.subject_person;
var loggedInUser = gs.getUserID();
var assignedToUser = current.assigned_to;
var watchListUsers = current.watch_list ? current.watch_list.toString().split(',') : [];
// Check if the logged-in user is opened_for, subject_person, or in the watch_list, and not assigned_to
if ((openedFor == loggedInUser || subjectPerson == loggedInUser || watchListUsers.indexOf(loggedInUser) > -1) && assignedToUser != loggedInUser) {
current.state = 'work_in_progress'; // Use your correct state value
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
how are you determining who is agent?
User with particular role? or user belonging to particular group
My thoughts
-> update BR condition as this i.e. Add big OR clause and update as this
-> then in BR condition check for role or group membership for logged in user (this covers your agent part)
add either of this in condition based on role or group check
!gs.hasRole('agentRole')
!gs.getUser().isMemberOf('Agent Group')
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Ankur,
Agent is the person who is assigned to the case. Watchlist is Dynamic Me will not solve the issue. Because, In watchlist there can be more than one person, and my use case is when user in watchlist add any additional comments then the state changes to WIP from suspended
Thanks,
Gokul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
watch list condition will work fine here
If you are in watch list along with others and you are updating the comments the BR condition will evaluate as true
Since Agent is the Assigned to of Case then update as this'
Watch List Dynamic Me works, see here
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar
Subject person and Watch list person will be different.
