- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi,
I'm working on some UI Action. In the RITM form I've a UI Action button.
My requirement is to when a user click on that button, I need to validate, if the logged in user is the user mentioned in the assigned_to field or anyother user.
How I can validate this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @BKSharma ,
You can use this script in UI action field.
var assignedTo = g_form.getValue('assigned_to');
var loggedInUser = g_user.userID;
if (assignedTo === loggedInUser) {
alert("You are the assigned user.");
} else {
alert("You are not the assigned user.");
}
Mark this as helpful and correct if this solves your question.
Thanks,
Yaswanth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @BKSharma ,
You can use this script in UI action field.
var assignedTo = g_form.getValue('assigned_to');
var loggedInUser = g_user.userID;
if (assignedTo === loggedInUser) {
alert("You are the assigned user.");
} else {
alert("You are not the assigned user.");
}
Mark this as helpful and correct if this solves your question.
Thanks,
Yaswanth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Thank you @YaswanthKurre ,
It worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @YaswanthKurre ,
I just need one more validation here, How I can check the logged In User is a part of same assignment group or not in the same UI action button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
your UI action is client side or server side?
Also why not show that UI action only to the user present in Assigned to field
You can add condition in UI action condition field
current.assigned_to == gs.getUserID()
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