How to Generate PDF Documention of incident record created by user

ajay98
Tera Contributor

How to generate pdf documentation of  particuler incident record created by user 

 

STEP's

 

Step 1: Create a custom action in flow designer and add script

  inputs:  1 -> sys_id

                2 -> table

                3 -> Attachment name

   script :

          ⬇️⬇️    

(function execute(inputs, outputs) {
// ... code ...

var v = new sn_pdfgeneratorutils.PDFGenerationAPI;
//  (Option) get HTML from the description field of an incident record
var gr = new GlideRecord(inputs.table);//Table name -----Access table name from flow input
var html;

if (gr.get(inputs.id)) {  //

   html="Number :"+gr.number.toString()+"\n"+"Caller Name : "+gr.caller_id.toString()+"\n"+"Short Description : "+gr.short_description.toString()+"\n"+"Description :"+gr.description.toString();

 //html = gr.description.toString();
}

var result = v.convertToPDF(html, inputs.table, inputs.id, inputs.name);
gs.info(JSON.stringify(result));

})(inputs, outputs);
 
save and publish
 
Step 2 : -
    -- Create a flow and trigger from incident(you can use own table according to requirement) table
   --  Add custom action in flow
Step 3 : Create new incident record 
Step 4: Attachment automatically Add after newincident create
   ⬇️

 

820fce13-021e-4bbc-b959-d568f99e533e.png

1 REPLY 1

Community Alums
Not applicable

Hi @ajay98 , what value do you provide as action input in name? 
I am trying to get the attachment and sent it out as notification within the flow.
Is there a way we can omit the part where the attachment is attached to the incident??