Need help on Approval Form Description

shaik_irfan
Tera Guru

Hi,

 

On the Approval Form, when the approval manager opens a record and click on Description it gives the details of all the Variables coming from RITM record. But our client want to display only filled variable but not empty variables is it possible ?

find_real_file.png

 

As shown in the image we want to display only short description since it contains information but the description variable is empty so we dont want to display that.

 

Please help me how to fix this 

1 ACCEPTED SOLUTION

Very weird and I can only presume an Orlando bug?

I resolved this issue on your instance by storing the value and doing a comparison to null

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g:evaluate jelly="true"> 
		var set = new GlideappVariablePoolQuestionSet();
		if (!JSUtil.nil(jelly.jvar_sc_req_item))
		set.setRequestID(jelly.jvar_sc_req_item);
		if (!JSUtil.nil(jelly.jvar_sc_task))
		set.setTaskID(jelly.jvar_sc_task);
		set.load();
	</g:evaluate>

	<table cellspacing="0" cellpadding="0" width="100%" data-sn-macro-sys-id="${jvar_macro_sys_id}">
		<j:forEach var="jvar_question" items="${set.getFlatQuestions()}">
			<j:if test="${jvar_question.isVisibleSummary()}">

				<j:set var="jvar_valuekma" value="${jvar_question.getDisplayValue()}"/>

				<j:if test="${jvar_valuekma != ''}">

					<g:summarize_question question="${jvar_question}" />
				</j:if>
			</j:if>
		</j:forEach>
	</table>
</j:jelly>

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@shaik.irfan 

you will have to customize the approval summarizer UI macro

I would recommend not to touch that as it is OOB

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@shaik.irfan 

you will have to create your own custom summarizer

refer link below

Create a new custom approval summarizer

refer my blog on custom summarizer for sysapproval_group table; something similar you can do for sysapproval_approver table

Approval Summarizer for Group Approvals

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Kieran Anson
Kilo Patron

Hi Shaik,

This is an approval summariser (OOB UI Macro approval_summarizer_sc_req_item). This in turn calls the approval_variable_summary macro.

This has a if statement to only include variables where the option "is visible on summary". You could add another if statement to only proceed with calling the summarize_question macro if the question has a value.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g:evaluate jelly="true"> 
		var set = new GlideappVariablePoolQuestionSet();
		if (!JSUtil.nil(jelly.jvar_sc_req_item))
		set.setRequestID(jelly.jvar_sc_req_item);
		if (!JSUtil.nil(jelly.jvar_sc_task))
		set.setTaskID(jelly.jvar_sc_task);
		set.load();
	</g:evaluate>

	<table cellspacing="0" cellpadding="0" width="100%" data-sn-macro-sys-id="${jvar_macro_sys_id}">
		<j:forEach var="jvar_question" items="${set.getFlatQuestions()}">
			<j:if test="${jvar_question.isVisibleSummary()}">
				<j:if test="${jvar_question.getDisplayValue()}"> <!--Added to remove null vars-->
					<g:summarize_question question="${jvar_question}" />
				</j:if> <!--Added to remove null vars-->
			</j:if>
		</j:forEach>
	</table>
</j:jelly>

 

find_real_file.png

 

Before Modification:

find_real_file.png

 

 

After Modification:

find_real_file.png

@Kieran Anson 

 

Thank you for the reply. I did pasted your code in my approval_variable_summary UI Macro. But which is making the entire formatter as empty

 

Previous: If you see Short Description contains information but Description is empty

find_real_file.png

 

After, adding your code it is empty. Am i making any mistake ?

 

I just copy pasted your code 

 

 

find_real_file.png