we are unable to access the fields on the task table when we are trying to glide record the table.

Ashokbabul
Tera Contributor

Hi Folks,

 

we are unable to access the fields on the incident record while querying through task table using the background script. but we are able to delete a incident record on the task table through background script.

is there any restriction for not able to accessing fields from the task table. Please check the screenshot in the attachments.

1 REPLY 1

Bhavya11
Kilo Patron

Hi @Ashokbabul 

 

 

When querying the task table in ServiceNow, you may encounter issues accessing fields specific to the incident table due to the way inheritance works in the ServiceNow data model. Although the incident table extends the task table, directly querying the task table might not expose fields that are specific to the incident table.

 

as like the your code i try in my PDI

 

var gr = new GlideRecord("task");
gr.addQuery("number=INC0010040");
gr.query();
if(gr.next()){
	gr.resolved_by='6816f79cc0a8016401c5a33be04be441';
	gs.print(gr.u_additional_comments);
	gr.update();
}

 

result: 

Bhavya11_0-1720071050286.png

because 'u_additional_comments' field is not present in task table it was present only in incident as custom field. in this case task table unable to find that fields in task

 

you can try like this directly to incident table  as that field is mainly belongs incident not able to access from task table.

 

var gr = new GlideRecordSecure("incident");
gr.addQuery("number=INC0010040");
gr.query();
if(gr.next()){
	gr.resolved_by='6816f79cc0a8016401c5a33be04be441';
	gs.print(gr.u_additional_comments);
	gr.update();
}

 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."

 

 

Thanks,

BK