Using Document Templates across scopes outside of HR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 01:17 AM
Hey All,
This is my first attempt to use Document Templates. It looks like it will work really well for me by incorporating a template with a script. So far I have successfully built the HTML template and tested it using the "Preview" button when viewing the template in Document Templates. Unfortunately, I've been unable trigger the form from the task using an UI Action. I would assume that I have it setup incorrectly.
This is the code I have that is triggered with an onclick UI Action:-
function exportTaskReport(){
var recordId = g_form.getUniqueValue();
documentTemplateId = 'sys id of the template';
var tblRec = new GlideRecord('custom_task');
tblRec.get(recordId);
var gd = new GlideDate();
var str = gd.getByFormat('yyyy_MMM_dd_hh_mm');
pdfName= tblRec.getValue('number') + '-' + str + '.pdf';
new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 03:05 PM
@SleepingCoder i am assuming no attachments on the "custom task" record? do you have the Document Templates (sn_doc) plugin?
do you get a cross scope error? when using sn_doc you may need to create a cross scope acess between document templates and your app....in the restricted caller access table [sys_restricted_caller_access].
- Navigate to: System Applications > Application Restricted Caller Access
- create a new record with the following fields:
- Source Scope: "your scope"
- Source Type: Scope
- Status Allowed
- Application: Document Templates
- Target Scope: Document Templates
- Target Type: Scope
- Description: Allow Scoped Application to have access to the plugin, Document Templates
I think if sn_doc plugin was installed afterwards there could be glitches as well. i usually install this plugin from the start