EXEC in WordRun JavaScript inside Word templates to calculate values such as deposits or project durations on the fly.Oct 14, 2025Knowledge
InformationArticle BodyExamples Use Case 1: Deposit and Remaining Balance If you wanted to calculate the deposit and remaining balance for an opportunity, you could use the following EXEC block. Example data: { Opportunity: { Amount: 10000 }} Template Document: Output: Use Case 2: Project Duration If you want to calculate the duration of a project, you could use the following EXEC block. Example data: { Project: { Project_Start_Date__c: "2024-01-01", Project_End_Date__c: "2024-01-10" }} Template Document: Output: Notes Avoid duplicating business logic already handled in Salesforce, you don't want to maintain that logic in two places. Next Steps About EXEC EXEC in Excel EXEC in PowerPoint EXEC in PDF TitleEXEC in WordURL NameEXEC-in-Word