How to fetch data from excel sheet and create payload when user upload excel sheet on catalog item form and order it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 03:57 AM
when user will click on order then how to fetch data from that uploaded excel file .
After then have to create payload and send to third party.
- Labels:
-
Service Catalog
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 04:18 AM
Hi
You can use Glide Excel Parser to read the data from excel and call third party api or application to send the data. Here is the Excel parser doc: https://developer.servicenow.com/dev.do#!/reference/api/quebec/server/GEPS-next
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 04:22 AM
But how .. the file is not placing in sys_attachment table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 04:24 AM
Where is that file getting saved when you attach it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 05:18 AM
var parser = new sn_impex.GlideExcelParser();
var attachment = new GlideSysAttachment();
var attachmentStream = attachment.getContentStream('6d655d892f6601103b7d3e0ef699b627');
//sys id of excel file which is placed in sys_attachment table
parser.parse(attachmentStream);
var arr=[];
var headers = parser.getColumnHeaders();
while(parser.next()) {
var row = parser.getRow();
var payload={};
for(var i=0;i<headers.length;i++){
payload[headers[i]]=row[headers[i]];
}
gs.print(JSON.stringify(payload));
arr.push(JSON.stringify(payload));
}
gs.print(arr);
It is working fine and i am able to create payload from excel file