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.

How to generate multiple excel attachements based on groupBy data

Haceena Shaik
Tera Expert

Hello all,

 

I got a business requirement like, Creating an excel sheet and sending an email to two reference fields on that table.

 

HaceenaShaik_0-1741626472185.png

As per the filter applied on that table, I need to apply group by 3 different fields, After grouping those data baed on 3 different fields, like Owned by  & Supported should be same with the same publisher.

 

for each set of grouped data, I need to pull each and every set into individual excel sheet.

I followed this thread to generate excel sheet,

 

But my use case is about to generate multiple attachments on grouping data

 

Generate Excel file (xls or xlsx) based on script - ServiceNow Community

 

Can anyone share me some inputs to work on this business use case.

 

Thanks in advance.

1 REPLY 1

Shivalika
Mega Sage
Mega Sage

Hello @Haceena Shaik 

 

This exactly can be done leveraging the Write functionality of GlideSysAttachment API class. 

 

Please refer the below link and method exactly for the process - 

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

 

If this doesn't aligns with you , you might have to do it individually and pull it. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway,

 

Regards,

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY