For some reason the packing slip advanced pdf disp...
# advancedpdf
j
For some reason the packing slip advanced pdf displays items when there is inventory detail attached on the item fulfillment, but not when there is no inventory detail attached. How can I get the form to display items without inventory detail as well?
d
maybe you could share the code from your template? The
<#list>
tag and what's inside it
j
Copy code
<#if salesorder.item?has_content>

<table class="itemtable" style="width: 100%; margin-top: 10px;">
<thead>
	<tr>
	<th colspan="12">${salesorder.item[0].item@label}</th>
	<th align="right" colspan="4">${salesorder.item[0].quantityordered@label}</th>
	<th align="right" colspan="4">${salesorder.item[0].quantityremaining@label}</th>
	<th align="right" colspan="4">${salesorder.item[0].quantity@label}</th>
	</tr>
</thead>
<#list salesorder.item as tranline><tr>
	<td colspan="12"><span class="itemname">${tranline.item}</span><br />${tranline.description}</td>
	<td align="right" colspan="4">${tranline.quantityordered}</td>
	<td align="right" colspan="4">${tranline.quantityremaining}</td>
	<td align="right" colspan="4">${tranline.quantity}</td>
	</tr>
	</#list></table>
</#if>
Changing <#if salesorder.item?has_content> to <#if salesorder.item??> yields the following error on the item fulfillment with no inventory detail, but works on ones with inventory detail:
Copy code
The template cannot be printed due to the following errors: Error on line 145, column 26 in template. Detail... The following has evaluated to null or missing: ==> salesorder.item[0] [in template "template" at line 145, column 28] ---- Tip: It's the final [] step that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${salesorder.item[0].item@label} [in template "template" at line 145, column 26] ---- Error on line 146, column 39 in template. Detail... The following has evaluated to null or missing: ==> salesorder.item[0] [in template "template" at line 146, column 41] ---- Tip: It's the final [] step that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${salesorder.item[0].quantityordered@... [in template "template" at line 146, column 39] ---- Error on line 147, column 39 in template. Detail... The following has evaluated to null or missing: ==> salesorder.item[0] [in template "template" at line 147, column 41] ---- Tip: It's the final [] step that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${salesorder.item[0].quantityremainin... [in template "template" at line 147, column 39] ---- Error on line 148, column 39 in template. Detail... The following has evaluated to null or missing: ==> salesorder.item[0] [in template "template" at line 148, column 41] ---- Tip: It's the final [] step that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${salesorder.item[0].quantity@label} [in template "template" at line 148, column 39] ---- Please contact your administrator.
d
Looking at your error message (formatted below for others' reference), it seems that the Sales Order your Item Fulfillment is linked to has no items. Read this SO answer about why using
??
might be the wrong thing to use (salesorder.item might be an empty list, so passes
??
but fails
?has_content
) I must ask, should you instead be using
record.item
instead of
salesorder.item
?
j
The Sales Order has items, so not sure why they do not show. I tried both ?? and ?has_content I tried record.item, but still nothing shows
176 Views