Ui Action PDF Preview is not working , not generating the document

Harsha1
Tera Contributor

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.

https://docs.servicenow.com/bundle/kingston-hr-service-delivery/page/product/human-resources/concept...

 

new GeneralHRForm(tableName, tableId, targetTableName, targetTableId).generate();
new GeneralFormAPI(fileName, targetTable, targetTableSysId);
GeneralFormAPI.SetDocument(header, footer, headerLocation, footerLocation);
GeneralFormAPI.createPDF(body);

 

Regards,

Harsha .

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

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?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Any browser console error?

Do you have any instance in lower version to compare how it looks?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Browser console error - js_includes_amb.jsx?v=08-23-2022_19WebSocket connection to 'wss://123.service-now.com/amb' failed: 

 

 

Do you have any instance in lower version to compare how it looks?

Yes, After clicking generate button , document will attach on HR task form  in manage documents.

 

Regards,

harsha .

Raya1
Tera Contributor

@Harsha1 did you managed to make it work? what is the content of the UI Page?