
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 05:25 AM
Hi All,
I'm looking to give users a view of their past request of a particular item by creating a simple list on the portal and filtering by the item. The issue I'm running into is that there is no way to pull the variables from the RITM. Has anyone done this already? I'd imagine it's a pretty common ask out there?
I appreciate any help you all can provide!!!
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 05:33 AM
Hi Glenn,
The first thing to note is that you will need a customer widget to do this. It's not available OOB because every RITM has different variables so there's no easy way to display them in a list.
If you choose to write a custom widget, you'll need to "load up" the data object for each record with the variables in the server script. Pretty straight forward when it comes to getting variables and values.
You can use this code in a mail script to print variables. This one assumes the message is on the sysapproval_approver table and gets the variables from the record pointed to by the sysapproval table. Below is a code snippet I use to get variable values for an approval record in to an email template. You can adjust the bold lines to your needs in the widget.
printVars();
function printVars(){
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sysapproval'));
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 02:08 PM
hi all
on the same lines i wanna display the variables in the email.
earlier i was using something like :
var gr = new GlideRecord("sc_req_item");
gr.addQuery("number", current.request_item.number);
gr.query();
var a =0;
while(gr.next()) {
template.print(gr.number + ":" + gr.cat_item.getDisplayValue() + "\n");
template.print(" Options:\n");
//template.space(4);
//template.print('<b>'+ Requested For+'</b>' ='+gr.variables.requested_for.getDisplayValue()+"\n"+"\n");
for (var key in gr.variables) {
var v = gr.variables[key];
template.print(' ' +'<b>'+v.getGlideObject().getQuestion().getLabel()+'</b>' + " = " + v.getDisplayValue() + "\n");
but now its not picking all the variables and instead stopping after 5 variables.
earlier it was all good. Is there any restriction with London release ?