Few users are not able to see the fields on My Tasks in EC Pro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 06:00 PM
Hi Community,
I've written a configuration of change approvals and knowledge approvals in 'My tasks' Few users are not able to see the fields on my tasks the record itself is showing as null, there is a record I've verified the script in widget both logs are passing to the users who are able to see the fields, but for few users fields are not visible and also only one log(sys_id). Is that some role ? Please help me with your insights.
server script(This is working for few usrs)
(function() {
data.pickupMsg = gs.getMessage(options.pickup_msg);
data.labelClose = gs.getMessage("Close");
var tableName = options.table || $sp.getParameter('table');
tableName = "change_request";
var sysId = options.sysId || $sp.getParameter('sys_id');
var record = sn_std_tkt_api.TicketConfig.getTicketRecord(tableName, sysId);
gs.addInfoMessage((sysId));
if (record == null)
return;
data.canRead = record.canRead();
if (!data.canRead)
return;
var gr = new GlideRecord("change_request");
gr.get(sysId);
//var gr = $sp.getRecord();
if (gr == null)
return;
data.canRead = gr.canRead();
if (!data.canRead)
return;
gs.addInfoMessage("GlideRecord sys_id: " + gr.getUniqueValue());
var agent = "";
var a = $sp.getField(gr, 'assigned_to');
if (a != null)
agent = a.display_value;
var fields = $sp.getFields(gr, 'number,requested_by,u_change_reason,opened_at,opened_by,cmdb_ci,u_impacted_country,state,short_description,priority,sys_created_on,conflict_last_run,u_impacted_bu,u_environment,assignment_group,impact,u_ppm_project_id,assigned_to,start_date,end_date');
if (gr.getValue("sys_mod_count") > 0)
fields.push($sp.getField(gr, 'sys_updated_on'));
data.tableLabel = gr.getLabel();
data.fields = fields;
data.agent = agent;
data.agentPossible = gr.isValidField("assigned_to");
data.table = gr.getTableName();
data.sys_id = gr.getUniqueValue();
})()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 06:11 PM
Hi @Janu sree
Try the following script, where I have added few logs for debugging.
(function() {
data.pickupMsg = gs.getMessage(options.pickup_msg);
data.labelClose = gs.getMessage("Close");
var tableName = options.table || $sp.getParameter('table');
tableName = "change_request";
var sysId = options.sysId || $sp.getParameter('sys_id');
var record = sn_std_tkt_api.TicketConfig.getTicketRecord(tableName, sysId);
gs.addInfoMessage((sysId));
if (record == null){
gs.info("Invalid record");
gs.addInfoMessage("Invalid record");
return;
}
data.canRead = record.canRead();
if (!data.canRead){
gs.info("User doesn't have access to record");
gs.addInfoMessage("User doesn't have access to record");
return;
}
var gr = new GlideRecord("change_request");
gr.get(sysId);
//var gr = $sp.getRecord();
if (gr == null)
return;
data.canRead = gr.canRead();
if (!data.canRead){
gs.addInfoMessage("User doesn't have access to record");
gs.info("User doesn't have access to record");
return;
}
gs.addInfoMessage("GlideRecord sys_id: " + gr.getUniqueValue());
var agent = "";
var a = $sp.getField(gr, 'assigned_to');
if (a != null)
agent = a.display_value;
var fields = $sp.getFields(gr, 'number,requested_by,u_change_reason,opened_at,opened_by,cmdb_ci,u_impacted_country,state,short_description,priority,sys_created_on,conflict_last_run,u_impacted_bu,u_environment,assignment_group,impact,u_ppm_project_id,assigned_to,start_date,end_date');
if (gr.getValue("sys_mod_count") > 0)
fields.push($sp.getField(gr, 'sys_updated_on'));
data.tableLabel = gr.getLabel();
data.fields = fields;
data.agent = agent;
data.agentPossible = gr.isValidField("assigned_to");
data.table = gr.getTableName();
data.sys_id = gr.getUniqueValue();
})()
Please mark my answer helpful and accept as solution if it helped 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 07:41 PM - edited 11-15-2023 09:25 PM
Hi @AnveshKumar M - I'm getting the one info message & log as 'User doesn't have access to record' and also sys_id.
Seems like user doesn't have access for the record, but how can they will see and approve as they are the approvers. Is this some role issue, but ho to identify on the role? Currently I'm working in the client's sandbox instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 09:57 PM
Hi @Janu sree
It is because of the ACLs configured. Do these approvers have an "approver_user" role? If not try giving them the "approver" role. (Log out, clear the browser cache, and log in again after giving the roles).
If still this didn't work try the workaround provided in the following KB article.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0620977
Please mark my answer helpful and accept as a solution if it helped 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 09:50 PM
User doesn't have required roles I believe, So I've added the approver_user role to him but still approval fields are not visible .