- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Everyone,
The assign to me ui action on service operation workspace doesn't shows up if it is assigned to someone else of the group i am already part of.
I want this should show if it is assgned to one of my group and not assigned to me then i want to show the button.
@Ankur Bawiskar what all changes i should do also the OOb script include and canassignedtome() button doesn't have the script to hide why its getting hided?
Regards,
Debasis
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Debasis Pati
Yes, this script will break the "Assign to Me" functionality for all other tables
The button will disappear entirely for every module except Incident.
Use this script as it uses your custom logic for Incident, but preserves the Out-of-the-Box (OOB) strict logic for everything else.
canAssignToMe: function(current) {
var currentTable = current.getTableName();
var arrayUtil = new global.ArrayUtil();
var allowedTables = ["problem", "incident", "change_request", "problem_task"];
if (!arrayUtil.contains(allowedTables, currentTable))
return false;
if (!current.active && !current.isNewRecord())
return false;
if (!this._checkRolesForAssignment(currentTable))
return false;
if (!current.assigned_to.canWrite())
return false;
if (currentTable == 'incident') {
// Hide if already assigned to ME
if (current.assigned_to == gs.getUserID())
return false;
return current.assignment_group.nil() || gs.getUser().isMemberOf(current.assignment_group.toString());
}
if (!current.assigned_to.nil())
return false;
return current.assignment_group.nil() || gs.getUser().isMemberOf(current.assignment_group.toString());
},
Happy to help! If this resolved your issue, kindly mark it as the correct answer ✅ and Helpful and close the thread 🔒 so others can benefit too.
Warm Regards,
Deepak Sharma
Community Rising Star 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Hello @Ankur Bawiskar & @Deepak Shaerma ,
Updated the script include function to this.
so the script function will explicitly act different for as it was earlier and will work as we need for incident table.
correct me if i have done any mistake.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
looks fine to me
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
share what condition is there currently or what script include function is being called and what's the current condition, screenshots
Logically since the task is already assigned it will be hidden since some agent is already working on it
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Ankur Bawiskar ,
the below is the ui action
https://yourinstance.service-now.com/sys_ui_action.do?sys_id=e44b67f63b330300a2bac9bb34efc46a&syspar...
script include:
https://yourinstance.service-now.com/sys_script_include.do?sys_id=a1b5e796531232000600e26b88dc3472
function name-canAssignToMe()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Logically speaking it makes sense to show button only in above cases
the function will return true if
-> if group is empty
OR
-> Logged in user is member of current group
But if you still require then I shared below approach
Update as this
Instead of updating the OOTB Script Include function simply update the condition in UI action
(new global.ArrayUtil().convertArray(gs.getUser().getMyGroups())).indexOf(current.assignment_group) > -1 && (current.state == 1 || current.state == 2) && current.assigned_to != gs.getUserID()
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Ankur Bawiskar ,
I found this button is from the task this one is not showing up on the portal.
Link:
https://yourinstance.service-now.com/sys_ui_action.do?sys_id=8513fcd0773b301027aae297cd5a9968&syspar...
so what i did is the below is used script include in the ui action;
SOWITSMCommonUtils
i have added one function and extended it:
as other tables are aslo involved will it affect them because this function is present inside "SOWITSMCommonUtilsSNC" script include so my solution is now working for incident table but i do not want to break the oob functionality for problem ,change or oither tables is it right approach?
