- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 10:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2022 03:29 AM
Hi,
you can add extra line to download it
var ritmSysId = current.sys_id;
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(ritmSysId);
set.load();
var vs = set.getFlatQuestions();
var valuesArray = [];
var csvHeader = [];
for(var i=0;i<vs.size();i++){
var variableLabel = vs.get(i).getLabel();
csvHeader.push(variableLabel.toString());
var variableValue = vs.get(i).getDisplayValue();
valuesArray.push(variableValue.toString());
}
var csvHeaderRow = csvHeader.toString();
var valueRow = valuesArray.toString();
var sa = new GlideSysAttachment();
var document = csvHeaderRow + "\n" + valueRow;
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.get(ritmSysId);
var sysId = sa.write(ritmRec, "catalog_variables.csv", "text/csv", document);
action.setRedirectURL('/sys_attachment.do?sys_id=' + sysId);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 10:56 PM
Hi
I have too many variables it's not coming in a proper format , is there any alternate solution to get these variables ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 11:09 PM
you can use printer friendly version to print.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 11:30 PM
but print friendly takes two three steps extra to download PDF , after clicking button it should directly download pdf of RITM variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 11:46 PM
try searching community links if you find something
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2022 05:23 AM
Hi,
Instead of taking lable name of variables can we take backend value of variables , because i have commas in variables so after downloading CSV it's taking two different variables