System Email Templates

We have a custom System Email Template.  On the HTML code we would like to display a paragraph only if one item in the Sales Order has a type of Download. item type = download.

This logic is at the end of the template and the problem is if we use an if statement it will only capture the last item type. Is there a way to store the type in a variable like isDownload = true when one of the item is a download. That way I can say if(isDownload).

Or something that can say if one item in the SO has a type of Download then display this paragraph.

Rookie Asked on August 28, 2023 in Other.
Add Comment
2 Answer(s)

Presuming this works like Advanced PDF Templates (I’ve not worked on an email template in forever), you should be able to create a variable, loop the item “list” and assign a value to your variable when you have a match.

You should then be able to evaluate your variable.

https://freemarker.apache.org/docs/ref_directive_assign.html

https://freemarker.apache.org/docs/ref_directive_list.html

This may also help as a starting point not specific to what you want but close.

<#assign variableName = "" >
<#list transaction.item as item>
  <#if item.itemname == "desiredItemName">
    <#assign variableName = item.itemquantity >
  </#if>
</#list>

Beginner Answered on August 28, 2023.
Add Comment

Nelliott,

Thanks for the template and link. I was able to solve my problem with your guidance.

Rookie Answered on August 28, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor