Create a incident record, when incident state changes to "Resolved." , Export a PDF of resolved incident automatically & attach a attachment in Email notification Send Notification to the caller with attached attachment of incident record.

Rushikesh5
Giga Guru

Hi, I have this requirement can anyone help me with this i.e. how to do it

  • Create an incident record, when incident state changes to "Resolved." ,
  • Export a PDF of resolved incident automatically & attach a attachment in Email notification.
  • Send Notification to the caller with attached attachment of incident record.

Thanks

1 ACCEPTED SOLUTION

@Rushikesh 

Glad to know that my approach worked.

Please mark my response as correct and helpful to close the thread.

Regards
Ankur

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

View solution in original post

18 REPLIES 18

you should give correct userid and password

Regards
Ankur

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

Hi,

Thanks for your time finally it's working 

 

Regards,

Rushikesh

@Rushikesh 

Glad to know that my approach worked.

Please mark my response as correct and helpful to close the thread.

Regards
Ankur

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

Gauravc
Tera Contributor

Hi @Ankur Bawiskar ,

 

I have the same requirement I have few doubt about this here,

In previous comment you said to provide correct userid and password.

I want to know from where I can pull this userid and password?

following code I am using with the logs i am getting the proper link to download the PDF but I am confused with Userid and password.

Please can you help me on this?

 

 var rm = new sn_ws.RESTMessageV2();
    rm.setHttpMethod('GET');
    var url = gs.getProperty("glide.servlet.uri") + current.getTableName() + '.do?PDF&sys_id=' + current.sys_id + '&sysparm_view=RCA_Export';
    rm.setEndpoint(url);
    // Create new properties and save user id and password of an admin account
    rm.setBasicAuth('admin', 'your password');
    rm.saveResponseBodyAsAttachment(current.getTableName(), current.getUniqueValue(), current.number + ".pdf");
    var response = rm.execute();
   
    gs.log('Attachment URL' + '-' + url + 'Recordname' + '-' + current.number );