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.

Output xlsx file in the specified format

hurm
Tera Contributor

HI ALL

I want to implement a function that outputs a file in a specified format after outputting list data.

Please help me.

 

(I think use for employee center or classic form)


image:
hurm_0-1721200627495.png

 

 

 

1 REPLY 1

jusfory1
Tera Expert

Embed npm xlsx.js in a macro, include ui macro by ui formatter.
Host the template by attachment or hard code it.
Logic in the ui macro:

  • run as server script: GlideRecord query;
  • run as client javascript: Generate a new xlsx file, iterate over the list object to assemble the data according to the template, write data to that xlsx file object, and then download it.