- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hello ,
I’m working on a Change Task (CTASK) form where we have three user reference fields:
Assigned To-
Change Observer--
Change Reviewer-->
The requirement is that the same person cannot be assigned to multiple fields.
So, for example, if a user is selected as the Change Reviewer, they should not appear in Change Observer or Assigned To, and vice versa.
This works fine when I first choose Assigned To, and then select the other fields — it correctly prevents duplicates.
The issue:
If I first select Change Reviewer or Change Observer, and then try to select Assigned To, the same user is still available to pick.
Thanks in advanced.😊
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
advanced ref qualifier looks fine to me.
another way is to use onSubmit client script and check this
function onSubmit() {
var user1 = g_form.getValue('u_change_reviewer'); // Replace with your field names
var user2 = g_form.getValue('u_change_observer');
var user3 = g_form.getValue('assigned_to');
// Check for repeats among the three reference fields
if ((user1 && user1 == user2) ||
(user1 && user1 == user3) ||
(user2 && user2 == user3)) {
g_form.addErrorMessage('Only unique users are allowed');
return false; // Prevent submission
}
return true; // Allow submission
}
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
Tuesday
Hi @tilekarnilesh,
you will might need to achieve this with onChange client script
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
@GlideFather How??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday - last edited Tuesday
@tilekarnilesh it will be 3 client scripts one for each field and you will add conditions that each of the field is changed, then it will checked the values in the other two
Navigate to: The GlideForm (g_form) Class and check for getValue()
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Please test your requirement with the above code and screenshot that i have shared and let me know .
if my response is helpful please mark as helpful and accept the solution
Thank you!!