Mustache Tag in Templates

In an iPaaS Template using Mustache, is it possible to hide a section when the evaluated value is false?  I'm attempting to hide/show template sections based on CheckBox true/false values passed from an iPaaS form to a Flow.

In this KB article it states: "Template tags can also be used to insert a section of HTML content that only displays when the section tag evaluates to True or a not empty value."

On the Mustache github page it states: If "key exists and has a value of false or an empty list, the HTML between the pound and slash will not be displayed."  On the Mustache demo page, setting the value to false hides the section, which is the behavior I'm trying to achieve.  However, in my template, the section still shows when the value is false.  The only way I've been able to successful hide a section is with an empty value (""). 

Asked by Eugene Kikuchi on Wed 6/21/23 3:41 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Mark Sayers Thu 6/22/23 12:03 PM

Hello Eugene,

We don't know that this is currently possible, but as a workaround you can create multiple small templates, and one "master" template, and use logic in the flow to take output from the small component templates and use them as the input into the larger master template. Basically splitting the template and using the flow's logic to piece it back together.

Would something like that work?

Sincerely,
Mark Sayers
Sr Support Consultant, CS

No feedback
Thanks for the suggestion, Mark. Can you elaborate on how a small component template (with Mustache tags) would be input into the master template? Would the template tags get populated in the smaller, or the larger template?

An alternative might be to concatenate the already constructed blocks of HTML from each smaller template within the flow, and not sending it to a master template. What's the maximum character limit for a flow Property?
- Eugene Kikuchi Thu 6/22/23 3:46 PM