IF in WordUse IF and END-IF tags to conditionally render content like discounts and renewal messages in Word templates.Sep 25, 2025Knowledge
InformationArticle BodyExamples Use Case 1: Line items table: show only discounted products Inside a FOR loop over Opportunity.LineItems, include a table row only when the line has a discount (e.g., LineItem.DiscountPercent > 0 or LineItem.HasDiscount__c = true). Example data: { "Opportunity": { "LineItems": [ { "ProductName": "Annual Subscription", "Quantity": 10, "UnitPrice": 120, "DiscountPercent": 0.15, "TotalPrice": 1020 }, { "ProductName": "Onboarding Package", "Quantity": 1, "UnitPrice": 2500, "DiscountPercent": 0, "TotalPrice": 2500 }, { "ProductName": "Premium Support", "Quantity": 1, "UnitPrice": 800, "DiscountPercent": 0.05, "TotalPrice": 760 } ], "TotalOpportunityPrice": 4280 }} Template Document: Output: Use Case 2: Renewal thank-you message Display a renewal thank-you block when the Opportunity is a renewal and is won (e.g., Opportunity.IsRenewal__c = true and Opportunity.StageName = "Closed Won"). Example data: { "Opportunity": { "Name": "FY25 MergeUp Subscription - Acme", "IsRenewal__c": true, "StageName": "Closed Won", "CloseDate": "2025-09-15", "RenewalEndDate__c": "2026-09-14", "TermMonths__c": 12, "Amount": 4000, "accName": "Acme Corporation", "ownerName": "Jordan Lee", "ownerEmail": "jordan.lee@upsource.solutions" }} Template Document: Output: Notes Variables defined in an EXEC command can be used in the conditions of an IF command.There are no ELSE IF or ELSE commands at the moment but you can use multiple IF commands with opposite conditions to achieve the same result Next Steps About IF IF in Excel IF in PowerPoint TitleIF in WordURL NameIF-in-Word