Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Export Form PDF with specifc tab data

avanishah
Tera Contributor

I have created a custom table and need to create UI Action which will export the PDF with certain data on form and send it to a particular email id

Example i have 4 tabs on form - General, A, B, C, which contains certain fields.

I need 3 UI Action where each UI Action will export and email the data contained in each tabs:
General + A

General + B

General + C

 

OOB Export PDF export the whole details of the form based on view, so i also tried creating a new view containing fields of tab General+A like mentioned in below link, but it doesn't work.
 https://www.servicenow.com/community/itsm-articles/export-to-pdf-in-agent-workspace-form-view-with-e...

 

I tried with steps mentioned in below link and created also a flow with action and notification, but need a solution where i can include the tab/section directly in script , as we do have many fields in each tab and adding them manually will be a tedious task and also concern in future if any additional fields are added. ghttps://www.servicenow.com/docs/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/...

 

If someone can help me with the below script in Flow action for how to add the section/tabs directly rather than inidivudal fields, that will be helpful :

(function execute(inputs, outputs) {
var v = new sn_pdfgeneratorutils.PDFGenerationAPI;

//  (Option) get HTML from the description field of an incident record
var gr = new GlideRecord(inputs.table);
var html;

if (gr.get(inputs.id)) {
 html = gr.description.toString();
}

var result = v.convertToPDF(html, inputs.table, inputs.id, inputs.name);
outputs.attachment_id = result.attachment_id;
outputs.status = result.status;
gs.info(JSON.stringify(result));
})(inputs, outputs);
0 REPLIES 0