ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 05:23 AM
Hi, I need to create an 'Assign to Me' button on the incident form. This button should only be visible when the 'Assign To' field is not already set to the current user, and when the current user has the 'itil' role. When clicked, the button should automatically assign the incident to the current user (in the 'Assign To' field) and set the 'Assignment Group' field to the default user group.
Thanks, Yarden
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 06:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 06:19 AM
Ok so you need to pass "sys_id" of default group :
g_form.setValue('assignment_group', <sys_id>);
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 06:15 AM
Action |
1. Assign current user to “assigned to” field 2. Assignment group = Default user group |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 06:26 AM
g_user in condition field won't work and it's wrong as shared in earlier screenshots.
In the condition field you should use server side code
gs.hasRole('itil') && current.assigned_to == ''
Script:
current.assigned_to = gs.getUserID();
current.assignment_group= 'groupSysId'; // give here the group sysId
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
09-07-2023 06:35 AM
Hi @Ankur
Yeah...I thing I missed that part....!!
Thanks for correction..!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates