Document Template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2025 03:26 AM
Hi
I've created a document template on incident table.
var recordId = 'a9a16740c61122760004fe9095b7ddca';(problem sys_id)
var documentTemplateId = '50e6c385db175e10727ee7dcd39619f2';
var pdfName = 'INC_Template.pdf';
new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);
with this script I'm trying to pass problem record sys_id which the incident attached to generate document for the problem record . but it's showing me the
sn_doc (GenerateDocumentAPISNC): User do not access to the record
how to generate document for problem (I'm using incident table to populate incident fields data)
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2025 03:37 AM
can you share the complete script?
you are running it from scoped app or global scope?
did you try passing INC sysId and see if it works?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2025 03:42 AM
var documentTemplateId = '31365c90474e62104bde39aa116d4376';
global and i tried with sys_id as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2025 03:57 AM
document template is configured in which scope?
if you are running script from global scope then it should work fine
are you using some complex script in your document template or straight forward field mapping?
may be it's breaking somewhere and hence not working
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2025 05:17 AM
@Ankur Bawiskar
it's showing user don't access the record(if it's prblm sys_id)
if it's incident sys_id then it's generating because in document template I've defined incident as table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2025 05:56 AM
sorry but you didn't answer my earlier questions
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader