we are unable to access the fields on the task table when we are trying to glide record the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 10:02 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 10:37 PM
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:
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