- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 02:16 AM
Hi Community,
After San diago upgrade , Ui action "Pdf Preview" is not working.
This is the code.
function previewDocument(){
var templateName = g_form.getValue('u_fulfillment_subtype');
var file = g_form.getValue('number');
var tableName = g_form.getTableName();
var templateTable = 'u_general_document_template';
var sysId = typeof rowSysId == 'undefined' || rowSysId == null ?
g_form.getUniqueValue() : rowSysId;
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass('Preview document dialog v2');
var msg = new GwtMessage().getMessage('Edit document');
dialog.setTitle(msg);
dialog.setPreference('sysparm_sysId', sysId);
dialog.setPreference('sysparm_sourceTable', tableName);
dialog.setPreference('sysparm_templateTable', templateTable);
dialog.setPreference('sysparm_templateName', templateName);
dialog.setPreference('sysparm_fileName', file);
dialog.render();
}
I found this article . How Can use the code in my code. I tried but not working.
new GeneralHRForm(tableName, tableId, targetTableName, targetTableId).generate();
new GeneralFormAPI(fileName, targetTable, targetTableSysId);
GeneralFormAPI.SetDocument(header, footer, headerLocation, footerLocation);
GeneralFormAPI.createPDF(body);
Regards,
Harsha .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 02:21 AM
Hi,
What's the error?
Did you check the browser console?
Is the UI page an OOB one? Preview document dialog v2
Can you share the complete requirement and relevant scripts as well?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 02:21 AM
Hi,
What's the error?
Did you check the browser console?
Is the UI page an OOB one? Preview document dialog v2
Can you share the complete requirement and relevant scripts as well?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023 05:21 AM
Hi Ankur,
I am also having the same issue, When i click on Preview PDF UI action, it is not giving anything, as it should show all the PDF documents which attached to the Work order task.
Below is my code:
function previewDocument(){
var sysId = typeof rowSysId == 'undefined' || rowSysId == null ?
gel('sys_uniqueValue').value : rowSysId;
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass('Preview document dialog v2');
var msg = new GwtMessage().getMessage('Edit document');
dialog.setTitle(msg);
dialog.setPreference('sysparm_sysId', sysId);
dialog.setPreference('sysparm_sourceTable', g_form.getTableName());
dialog.setPreference('sysparm_templateTable', 'u_general_document_template');
dialog.setPreference('sysparm_templateName', 'Stowe Job Card');
dialog.setPreference('sysparm_fileName', g_form.getValue('number'));
dialog.render();
}
Kindly help me with this
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023 05:25 AM
Browser console:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 02:38 AM
Hi Ankur,
Not the OOB. it's customized UI action.
Error is - When I am clicking on ‘Preview PDF’, a template pops up and after scrolling down to the bottom
,when we click on ‘Generate’ , the document doesn’t get generated. Just getting a blank screen.
I have attached both the images.
Requirement is - This is the table General Document Templates.
In the Body section have some content. We want this template will display on HR task form by clicking the UI action " PDF Preview".
Regards,
Harsha .