- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017 04:06 AM
Hi,
I don't understand what kind of variables are shown on the Approval Form, because i've noticed that not all variables are shown.
I would like to know how to show only variables that are visible in Catalog Item view, is this possibile? How can i do this?
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2017 11:56 AM
Hi Emanuele,
You will need to investigate the Approval Record widget. You can see this line there:
if (itemsGR)
item.variables = $sp.getRecordVariablesArray(itemsGR);
Which then is used in the body to display those:
<div ng-repeat="variable in item.variables" class="m-b-xs" ng-if="variable_toggle">
<label>{{::variable.label}}</label>
<div>{{::variable.display_value}}</div>
</div>
Unfortunately I can't see any docs about getRecordVariablesArray and how it gathers those variables:
Regards
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017 05:07 AM
Hi,
Can you elaborate more on your issue? Screenshot provided would be more helpful in debugging.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017 08:39 AM
Hi Shloke,
my issue is on the approval form on the Service Portal, this is an example:
Under the Options are shown some variables that i've defined in the request.
I don't understand what kind of variables are displayed: in this example the first 4 variables are displayed in catalog item view, but the last 2 are hidden on the service portal and there are other variables that i've defined which are not visible... why? How can i select the variables to show?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2017 11:56 AM
Hi Emanuele,
You will need to investigate the Approval Record widget. You can see this line there:
if (itemsGR)
item.variables = $sp.getRecordVariablesArray(itemsGR);
Which then is used in the body to display those:
<div ng-repeat="variable in item.variables" class="m-b-xs" ng-if="variable_toggle">
<label>{{::variable.label}}</label>
<div>{{::variable.display_value}}</div>
</div>
Unfortunately I can't see any docs about getRecordVariablesArray and how it gathers those variables:
Regards
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017 05:44 AM
Hi Emanuele,
I was able to get this requirement by:
Step 1: creating an Email Script:
template.print("<b>Summary of Requested items:</b>\n\n");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.sysapproval);
item.query();
while(item.next()) {
// template.print(" Options:\n");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
template.space(4);
template.print(' ' + 'Requested by: ' + item.request.requested_for.getDisplayValue() + "\n");
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + ": " + vs.get(i).getDisplayValue() + "\n");
}
}
}
Step 2: And then using this script on your template, for example:
Dear ${requested_for},
please review the SAP user request. Below you will find links to approve or reject it.
Please see details below:
${mail_script:sysapproval_approver_script_sap_user}//this is the notification script created in Step 1.
---
Kind regards,
your IT Service Desk
Step 3: You will be able to use this template for your Approval Inserted Notifications.
The email script will display all variables except for those null variables.
Let me know if this helps.