Request Item variables in Approval Summarizer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2009 11:52 AM
Is it possible to utilize variables and their values in the approval summarizer screen?
This is one of my most common requests from managers. "Why do I have to cilck on another screen to see the information I am going to approve?" I'd like to put as much information on the approval screen as necessary to give them an idea of what they are approving beyond "New PC hardware" or "Folder permission request".
When I look at the object id of my "Additional Comments" variable that I use in many forms, it is something like ni.VEcdc4b6fe0a0a3c0e13cc48e36998ea41
I tried using (unsuccessfully) in the jelly code similar to how "Special Instructions" is used, like this:
<tr>
<td class="label_left" width="150px">
<label style="margin-left:10px">${ni.VEcdc4b6fe0a0a3c0e13cc48e36998ea41.sys_meta.label}: </label>
</td>
<td> ${ni.VEcdc4b6fe0a0a3c0e13cc48e36998ea41}
<g:label_spacing/> </td>
</tr>
Since each request item may have different variables, a script that loops through each set of variables would be the best so I can provide as much information to the approver without going to the request item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2010 04:47 PM
This version leverages the code from this post:
Showing Request Item / Catalog Variables in Mail Script
To get the variables in order. Seems to work for me.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<tr>
<td class="label_left" width="100%">
<label style="margin-left: 10px"><b> ${gs.getMessage('Summary of Requested Item being approved')}: </b>
<g:label_spacing/> </label>
</td>
</tr>
<g:evaluate var="jvar_ni" expression="
var sc_req_item = ${ref}.sysapproval;
"/>
<tr>
<td width="100%">
<table width="100%">
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${sc_req_item.cat_item.sys_meta.label}: </label>
</td>
<td>
${sc_req_item.cat_item.name}
</td>
</tr>
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${gs.getMessage('Request Number')}:</label>
</td>
<td> ${sc_req_item.request.number.getDisplayValue()}
<input style="visibility: hidden" NAME="make_spacing_ok"></input> </td>
</tr>
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${gs.getMessage('Requested for user')}:</label>
</td>
<td>
${sc_req_item.request.requested_for.getDisplayValue()}
</td>
</tr>
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${gs.getMessage('Request created by')}:</label>
</td>
<td>
${sc_req_item.request.opened_by.getDisplayValue()}
</td>
</tr>
<g:evaluate var="ni" expression="
var totalPrice = sc_req_item.price.toString();
if (totalPrice != '') {
totalPrice = parseFloat(totalPrice);
totalPrice = totalPrice.toFixed(2);
var totalPriceIsZero = false;
}
"/>
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${sc_req_item.price.sys_meta.label}: </label>
</td>
<td>
${totalPrice}
</td>
</tr>
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${sc_req_item.u_price_detail.sys_meta.label}: </label>
</td>
<td>
${sc_req_item.u_price_detail}
</td>
</tr>
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${sc_req_item.request.special_instructions.sys_meta.label}: </label>
</td>
<td>
${sc_req_item.request.special_instructions}
</td>
</tr>
<tr>
<td colspan="2">
$[SP]
</td>
</tr>
<tr>
<td class="label_left" colspan="2">
<b> Requested Item Variables: </b>
</td>
</tr>
</table>
</td>
</tr>
<j:set var="jvar_line_num" value="0" />
<tr>
<td width="100%">
<table width="100%">
<j:set var="jvar_line_color" value="odd"/>
<j:set var="jvar_line_num" value="${jvar_line_num + 1}"/>
<j:if test="${jvar_line_num % 2 == 0}">
<j:set var="jvar_line_color" value="even"/>
</j:if>
<g:evaluate var="ni" expression="
var smart_description = sc_req_item.cat_item.short_description;
if (smart_description == null || smart_description == '' || smart_description == 'undefined')
smart_description = sc_req_item.cat_item.name;
"/>
<g:evaluate jelly="true">
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery("request_item", current.sysapproval);
varown.query();
</g:evaluate>
<j:while test="${varown.next()}">
<j:set var="jvar_visible" value="${varown.sc_item_option.item_option_new.visible_summary}"/>
<g:evaluate var="jvar_label">
var question = Packages.com.glideapp.questionset.Question.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
question.getLabel();
</g:evaluate>
<g:evaluate var="jvar_display_value">
var question = Packages.com.glideapp.questionset.Question.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
question.getDisplayValue();
</g:evaluate>
<j:if test="${jvar_label != ''}" >
<j:if test="${jvar_display_value != ''}" >
<j:if test="${jvar_display_value != 'false'}" >
<j:if test="${jvar_visible == 'true'}" >
<tr>
<td class="label_left" width="300px">
<label style="margin-left: 10px">${jvar_label}: </label>
</td>
<td>${jvar_display_value}
<input style="visibility: hidden" NAME="make_spacing_ok"></input>
</td>
</tr>
</j:if>
</j:if>
</j:if>
</j:if>
</j:while>
</table>
</td>
</tr>
</j:jelly>