- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 06:57 AM - edited ‎01-12-2024 07:11 AM
Hi
I would like to confirm that the "Assign to me" button in the HR Agent Workspace is not added by default by ServiceNow?
Or is it up to the companies and they can add it if they want. I am not sure why the button is not visible in the HR Case workspace view and the agent has to manually assign themselves, whereas it is available in the native UI.
In UX Form Actions (sys_ux_form_action) I don't see 'Assign to me' button for any HR Case table.
I know how to enable it in the UI Action (for HR Case, 'Workspace Form Button' is unchecked). What is the process behind this? Was it configured that way by design?
If anyone can shed some light on this, I would be grateful.
Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 07:39 AM
@miro2 You assumption is correct the "Assign to me" button is not added by default in HR Agent workspace. You need to follow the following steps to make this button visible and function in HR Agent workspace.
1. Navigate to UI Actions in the backend. Filter Assign to me button for sn_hr_core_case table.
2.Scroll to the bottom and check the workspace related checkboxes, and add the script in the script field.
Here is the script for your reference.
function onClick(g_form) {
assignToMe();
function assignToMe() {
g_form.setValue("assigned_to", g_user.userID);
g_form.submit(g_form.getActionName());
}
}
Here is how the button looks on the workspace.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2024 03:01 PM
Hi @Zach3 ,
It worked for me.
I marked the UI action as not client and added the below script.
current.assigned_to = gs.getUserID();
current.update();
action.setRedirectURL(current);
Please accept solution OR mark helpful.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2024 03:16 PM
Thanks ahefaz1. Unfortunately, that did not work on our instance. What did work was using the Workspace Client Script from the Service Operations Workspace ITSM Common application's "Assign to me" (8513fcd0773b301027aae297cd5a9968) UI action.
For anyone else looking to make it work, these are the updates we made on the "Assign to Me" UI action (24e08b0edb2277805edefcd6f4961944):
- Set Workspace Form Button to true
- Set Format for Configurable Workspace to true
- Set Workspace Client Script to
function onClick(g_form) {
getMessages(["Select Assignment Group", "Cancel", "Assign", "Assignment Group"], onCopy);
function onCopy(tMsgs) {
var ga = new GlideAjax("sn_sow_itsm_common.SOWITSMCommonClientUtils");
ga.addParam("sysparm_name", "getMemberGroups");
ga.addParam("userSysID", g_user.userID);
ga.getXMLAnswer(function(response) {
try {
answer = JSON.parse(response);
} catch (e) {
return;
}
if (g_form.isMandatory("assignment_group") && answer.length > 1 && !g_form.getValue('assignment_group')) {
var choices = [];
for (var i = 0; i < answer.length; i++) {
choices.push({
displayValue: answer[i].displayName,
value: answer[i].sys_id,
});
}
g_modal.showFields({
title: tMsgs["Select Assignment Group"],
cancelTitle: tMsgs["Cancel"],
confirmTitle: tMsgs["Assign"],
cancelType: "default",
size: "md",
confirmType: "confirm",
fields: [{
type: 'choice',
name: 'assignment_group',
label: tMsgs['Assignment Group'],
choices: choices,
mandatory: true
}],
}).then(function(fieldValues) {
g_form.setValue('assignment_group', fieldValues.updatedFields[0].value);
g_form.setValue('assigned_to', g_user.userID);
g_form.save();
});
} else {
assignToMeHelper(answer);
}
});
}
}
function assignToMeHelper(answer) {
if (!g_form.getValue('assignment_group')) {
var memberGroups = answer;
if (memberGroups.length == 1)
g_form.setValue('assignment_group', memberGroups[0].sys_id);
}
g_form.setValue('assigned_to', g_user.userID);
g_form.save();
}​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2024 03:41 AM - edited ‎01-20-2024 03:43 AM
Hi @Zach3
This also works for me to save HR case on HR agent workspace when agent hits Assign to me button
g_form.setValue('assigned_to', g_user.userID);
g_form.save()
Could you share your previous configuration/script that didn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 01:19 PM
Hi @miro2 - I tried the script from ahefaz1 listed above:
current.assigned_to = gs.getUserID(); current.update(); action.setRedirectURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 01:34 PM