About IFLearn how the IF template command controls conditional content in templates.Sep 25, 2025Knowledge
InformationArticle BodyOverview The IF template command evaluates a JavaScript condition and includes content only when the condition is true. Use IF to control which parts of a template are displayed for a given record. Key Functionalities Show or hide content based on data.Combine with other commands to build dynamic sections.Supports any JavaScript expression that returns a boolean. Syntax {# IF condition #} Content to show if condition is true{# END-IF #} Examples Example 1: Conditionally display an image {# IF Account.Type === 'Customer' #} <img alt="Customer Logo" src="Image_URL" />{# END-IF #} Example 2: Use IF inside a FOR loop {# FOR opp IN Account.Opportunities #}{# IF $opp.Amount >= 10000 #}- {# $opp.Name #} ({# c($opp.Amount) #}){# END-IF #}{# END-FOR opp #} Notes Both the IF and END-IF tags are removed from the merged document.Place the IF and END-IF tags on their own lines to avoid extra whitespace.Conditions can use any JavaScript comparison operators (==, !=, <, >, <=, >=). Conclusion IF provides a simple way to add conditional logic across Word, Excel, and PowerPoint templates. Next Steps IF in Word IF in Excel IF in PowerPoint TitleAbout IFURL NameAbout-IF