need hlep in writting data on an excel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 01:04 AM
Hi,
My requirement is to create a item, based on what end user has filled in variables. the same data should be written on excel.
it has different sheets, it should fill in the data.
Thankyou,
Priya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 02:44 AM
you want to create excel file or you want to create RITM by parsing excel file?
what's your business requirement here?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 03:23 AM
Hi @Ankur Bawiskar
so the requirement is when user needs a new catalog item basically what the requestor do is take a template and fill in the data and send it for development.
template looks like below
from here the requirement starts.
so instead of user picking up the excel and filling the the info we came up with an idea of creating an item and list out the variables
example:
1. under general info label we have variables request item name, business application, description etc... listed in above template
2. and next comes catalog item variables label under that we have variables listed in screenshot.
3.the last one is workflow and below are the variables will be listed under workflow label.
so when item gets submitted on RITM we need excel attached with the variable info filled by the user.
example below:
so am stuck at writting the info from RITM Variables to excel.
Thankyou
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2023 03:46 AM
Hi,
I am not sure about the excel file, but a csv file can be generated and can be attached to the RITM using script.
Sample Script:
var grX = new GlideRecord(targetTable);//Whatever your table
grX.addQuery('sys_id',targetSys_id);//the record's sysid on which you want to add this
grX.query();
if(grX.next())
{
var grAttachment = new GlideSysAttachment();
grAttachment.write(grX, fileName, 'application/csv', csvData);
}
//Name can be of your choice like fileName=DemoCSVFile
//the data can be like below
//csvData="Name;Address;ID\nSaurabh;India;Ge5363\nWilliam08;Out of India;Ge1234"
//You have to build the csvData Variable as per your need
Thanks and Regards,
Saurabh Gupta