- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:04 PM
Hi All,
I am not able to update or create or delete record in Document Tasks using
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 12:34 AM
Document task table is in "Document templates" application scope. We don't have option to select this scope in background script. For this scope related error you need to create restricted caller access record.
Second way to achieved this is change your scope to "Document templates" and Create fix script. So this fix script will get created in "Document templates" only and then add your code. Then simply click on "Run Fix script".
Also in your code, parent is a reference field so use the HR case sys ID instead of HR case number
var gr = new GlideRecord('sn_doc_task');
gr.addEncodedQuery('number=DOCT0001111);
gr.addQuery('parent','a07f7b8e8a9370cbb354edfdffdfdfdf');
gr.query();
if(gr.next()){
gs.info(gr.number);
gr.setWorkflow(false); //Disable business rules for this query
gr.deleteRecord();
}
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:41 PM
Hi there,
Haven't verified yet, though "parent", isn't that a reference field? You are querying on a number?
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:47 PM
Hi ,
I am receiving this error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:50 PM
Ah oke scope issue. So did you follow what is mentioned in the logs? Clear error.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:49 PM
Just verified, indeed as expected, parent is a reference field. That's you issue 😀
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field