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 05:39 AM - edited ‎09-07-2023 05:50 AM
Hello @yardenKrispel
Find the screenshot below.
You can create new UI action on incident table.
function assignToMe(){
var assignedTo = g_form.getValue('assigned_to');
if(!assignedTo){
g_form.setValue('assigned_to', g_user.userID);
// you can set the assignment group as well
gsftSubmit(null, g_form.getFormElement(), 'assign_to_me'); //MUST call the 'Action name' set in this UI Action
}
if (typeof window == 'undefined') {
updateRecord();
}
function updateRecord(){
current.update();
}
}
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 05:55 AM
To hide UI action depend upon condition check this community link :
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:07 AM
Thank you! The 'Assign To' functionality now works as intended. However, I am still facing an issue with automatically populating the 'Assignment Group' field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 06:12 AM
can you send the screenshot of your code...!!
May be for group you need to pass sys_id of that group
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates