Few users are not able to see the fields on My Tasks in EC Pro

Janu sree
Tera Guru

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();
})()




Janusree_0-1700099746614.png

Janusree_1-1700099995612.png

 

 

7 REPLIES 7

AnveshKumar M
Tera Sage
Tera Sage

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 👍

Thanks,
Anvesh

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 

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 👍

Thanks,
Anvesh

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 .

 

Janusree_1-1700113807280.png