Hide Empty Variables on Approval Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2014 11:33 PM
Hi,
I have a requirement to display the variable editor from the requested item and display it on the approval record and additionally hide the empty variables.
I managed to display the variables on the approval record by modifying the "approval_summarizer_sc_req_item" Macro with the xml from "approval_summarizer_default".
My only issue now is that I want to hide the empty variables on the approval record. I'm able to hide this on the requested item using an on display business rule and client client script (http://www.servicenowguru.com/scripting/business-rules-scripting/hide-empty-variables-standard-form/), however this method will not work on the approval record as the variables are being rendered from the Macro.
Would appreciate if anyone knew how to modify the UI Macro to achieve this result.
Thanks in advance.
Anthony

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 10:51 PM
Hi Anthony,
I rarely have worked on GlideController or GlidePopup objects, so i'm not completely aware of the ways to hide variables in them.
May be someone who has would be able to guide you. Also, I'll let you know if i find anything related.
Thanks,
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 09:40 AM
Hi Anthony -
Not sure if this would help you, but I've done something similar that is pretty straight forward. If you follow through the approval summarizer macros, you should eventually get to approval_variable_summary. This has a section of code that loops through all variables associated with the request and writes them out. The default code looks like:
<j:forEach var="jvar_question" items="${set.getFlatQuestions()}">
<j:if test="${jvar_question.isVisibleSummary()}">
<g:summarize_question question="${jvar_question}" />
</j:if>
</j:forEach>
By adding a couple of tests inside the loop, you can reasonably filter out the empty variables as such:
<j:forEach var="jvar_question" items="${set.getFlatQuestions()}">
<j:if test="${jvar_question.isVisibleSummary()}">
<j:if test="${jvar_question.getDisplayValue()!="}">
<j:if test="${jvar_question.getDisplayValue() != '— None —'}">
<g:summarize_question question="${jvar_question}" />
</j:if>
</j:if>
</j:if>
</j:forEach>
This will cause all variables with an empty value or list variables that have a value of '-- None --' (default when option selected) to not be displayed.
Also, if you have variables that should never be displayed on the summary, you can use the "Visible on Summaries" option on the variable definition itself. By default, this option is both enabled and not displayed on the variable form. By adding this to the variable form you can de-select this option and the variable will never display on the summary (regardless of whether it is empty or not).
I've got a little more of a write-up on my site here at SN Revealed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2015 09:22 AM
Hi Bill,
I tried the above macro inside the approval_varriable_summary, but i am getting the below error,
Error at line (15) Open quote is expected for attribute "test" associated with an element type "j:if".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2015 08:44 AM
Did you get this work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 01:42 PM
I got this to work with two single quotes (!=''), which am guessing is what was originally posted but auto formatted to a single double quote:
<j:if test="${jvar_question.getDisplayValue()!=''}">
So, the full thing:
<j:forEach var="jvar_question" items="${set.getFlatQuestions()}">
<j:if test="${jvar_question.isVisibleSummary()}">
<j:if test="${jvar_question.getDisplayValue()!=''}">
<j:if test="${jvar_question.getDisplayValue() != '— None —'}">
<g:summarize_question question="${jvar_question}" />
</j:if>
</j:if>
</j:if>
</j:forEach>