
- 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
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
02-05-2018 05:41 AM
Thanks Chuck!!!
bawiskar actual turned on a lightbulb for me. I did this before with a dreaded database view where i tied the approval and the sc_req_item together to send reports out. I might be able to just keep my simple list OOB and setup a view to do the same?
Glenn

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 07:43 AM
Hi All,
I just confirmed that the DB view option won't work. The list widget doesn't like DB views at all. It looks like I'll have to clone the OOB widget and pull in the information that way. ctomasi or bawiskar or ashutoshm1 do you have and code for doing this in a widget? Something tells me there is a bit more to it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 07:54 AM
Awesome,
That is what i was telling you!
What you can do is you can edit html of OOB widget and just add couple of extra line to that code and then pull information of variables from server side code and then append them to that HTML element.
Can you tell me if you want them to be shown where?
Any screen shot will help.
Thanks