How do i break page between two topics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 08:26 AM
How do i break page between two topics
Prier NCNTS Events comes in different page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 09:23 PM
@pramn This script include "GenerateAndAttachPDF" is not the OOTB script include. Seems like some plugin is installed to exporting the PDF. Please check the plugin details there might some configuration done for the table you are exporting data.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 09:31 PM
var GenerateAndAttachPDF = Class.create();
GenerateAndAttachPDF.prototype = Object.extendsObject(AbstractAjaxProcessor, {
/*
Description: Generate a PDF from HTML and attach to the record requested
Usage case: new GenerateAndAttachPDF('<p>Test<</p>', current.getTableName(), current.sys_id, 'export.pdf');
Returns: Attaches a pdf to the record table/sys_id provided. No return as such.
*/
createPDF : function(html, table, sys_id, filename) {
var pdfDoc = new GeneralPDF.Document(null, null, null, null, null, null);
this._document = new GeneralPDF(pdfDoc);
this._document.startHTMLParser();
this._document.addHTML(html);
this._document.stopHTMLParser();
this._saveAs(table, sys_id, filename);
},
/*
Description: Attaches generated PDF to the record inputted
Usage case: Private class, called only internally from this Script Include
Returns: Attaches a pdf to the record table/sys_id provided
*/
_saveAs : function (table, sys_id, filename){
var att = new GeneralPDF.Attachment();
att.setTableName(table);
att.setTableId(sys_id);
att.setName(filename);
att.setType('application/pdf');
att.setBody(this._document.get());
GeneralPDF.attach(att);
},
/*
Description: If this attachment has been attached to the same record before, delete it
Usage case: Call server side or it is also called by default from client callable function below
Returns: No return. Deletes records.
*/
removeDuplicateAttachments : function (sysid, filename) {
var alreadyAttach = new GlideRecord("sys_attachment");
alreadyAttach.addQuery("table_sys_id", sysid);
alreadyAttach.addQuery("file_name", filename);
alreadyAttach.query();
while (alreadyAttach.next()) {
alreadyAttach.deleteRecord();
}
},
/*
Description: Client Callable function to take advantage of the other functions above.
Returns: Attaches a pdf to the record table/sys_id provided
*/
attachFromClient : function(){
var html = this.getParameter('sysparm_html');
var table = this.getParameter('sysparm_table');
var sys_id = this.getParameter('sysparm_sysid');
var filename = this.getParameter('sysparm_filename');
//var filename = "export.pdf";
this.removeDuplicateAttachments(sys_id, filename);
this.createPDF(html, table, sys_id, filename);
},
type: 'GenerateAndAttachPDF'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 09:39 PM
@pramn Paste your html code here. Got the solution.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 09:50 PM
@pramn Got the HTML from other question. Please update the HTML as below that should solve your problem.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 10:08 PM
still its mixing the page ...Remediation and NCNTS event coming in same page