Can we generate word document from the workflow

Nagashree5
Tera Contributor

Hi All,

 

Currently, A PDF is generated from a workflow with all the variable values once a request is submitted. I'm using the PDFGenerationAPI() for this and below is the code I'm using in the workflow Run script which is working as expected.

var fileName = 'REQ_' + current.number;
var pageProperties = {	
HeaderImageAttachmentId:'',
HeaderImageAlignment: 'LEFT', 
PageSize: 'A4',
GeneratePageNumber: 'true',
TopOrBottomMargin: '72',
LeftOrRightMargin: '36'
};
var html = '<html>' +
'<head>' +
'<title></title>' +
'</head>' +
'<body>' +
'<h2>My Request</h2>' +
'<ul>' +
'<li>Open on behalf of this user: '+ current.variables.open_on_behalf_of_this_user.getDisplayValue() + '</li>' + 
'<li>Please identify what you require: ' + current.variables.please_identify + '</li>' + 
'</ul>' +
'<p>Authorised approver:<br />' +
current.variables.authorised_approver + '</p>' +
'<p>&nbsp;</p>' + 
	'</body>' + 
	'</html>';
var pdf = new sn_pdfgeneratorutils.PDFGenerationAPI().convertToPDFWithHeaderFooter(html, 'sc_req_item', current.sys_id, fileName, pageProperties, ''); 
result = JSON.stringify(pdf);

This is working as expected and a PDF is generated once a request is submitted. But the requirement is to generated a word document in the same way.

Can anyone suggest a way of doing this.

Any help would be highly appreciated. 

 

Regards,

Nagashree.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Nagashree5 

no direct way for this.

you would require custom solution for doc and mid server for docx

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Nagashree5 

no direct way for this.

you would require custom solution for doc and mid server for docx

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar, Thanks for the response.

what is the custom solution for this to work, Can you pls suggest

@Nagashree5 

Nothing in my mind as of now as I haven't had any such requirement from any customer.

Since this is not available OOB, I would suggest you to inform your customer about the limitation of platform.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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