- 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
Hello @Ankur Bawiskar ,
have you got time to check my last reply?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you earlier shared the UI action for workspace for which I shared solution
I am not sure why you are now referring to Portal requirement
You can enhance it for incident like this so that it impacts only incident and for other table it behaves as it is
-> create new script include function and check the table name
-> if it's INC then apply the logic I shared
-> if it's not INC then keep OOTB logic
💡 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 ,
No i am working on workspace only i also thought that should be the button which is getting visible.
But that's not the button showing on workspace the button which is on task table for workspace also that is getting visible there on the incident that is why i shared this.
So i did the same i am wondering will it affect the other tables.
https://yourinstance.service-now.com/sys_ui_action.do?sys_id=8513fcd0773b301027aae297cd5a9968&syspar...
Script include: SOWITSMCommonUtils
the script include extends "SOWITSMCommonUtilsSNC" and this is having the function
updated function below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you should check if table is INC or not
but you are not checking that
💡 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
I update as this, use that and test
canAssignToMe: function(current) {
var currentTable = current.getTableName();
if (currentTable == 'incident') {
return (new global.ArrayUtil().convertArray(gs.getUser().getMyGroups())).indexOf(current.assignment_group) > -1 && (current.state == 1 || current.state == 2) && current.assigned_to != gs.getUserID();
} else {
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 (current.assigned_to)
return false;
return current.assignment_group.nil() || gs.getUser().isMemberOf(current.assignment_group.toString());
}
},
💡 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
