DocumentRenderV2Command - Template Guide
Overview
This guide provides ready-to-use Word document templates for DocumentRenderV2Command. Each template demonstrates different features and can be customized for your needs.
Template Syntax Reference
1. Simple Variables
Replace text with a value from the context:
{{variableName}}
2. Nested Properties
Access object properties using dot notation:
{{customer.name}}
{{customer.address.street}}
3. Conditional Sections
Show/hide content based on conditions:
{{#if condition}}
Content shown when condition is true
{{/if}}
4. Lists/Arrays
Repeat content for each item in an array:
{{#each arrayName}}
{{this.propertyName}}
{{/each}}
5. Table Row Repetition
Repeat table rows for array data:
Row 1: Add marker {{#arrayName}} in first column
Row 2: Template row with placeholders like {{this.column1}}
Row 3: Add marker {{/arrayName}} in first column
6. Paragraph Blocks
Repeat entire paragraphs:
{{#paragraphBlock:arrayName}}
Template paragraph content
{{/paragraphBlock:arrayName}}
Available Templates
1. Loan Agreement Template
File: loan-agreement-template.docx
Use Case: Loan origination, loan disbursement
Context Variables:
agreementDate- Date of agreementcustomerName- Customer full namecustomerId- Customer IDloanAmount- Loan principal amountinterestRate- Annual interest ratetenure- Loan tenure in monthsmonthlyPayment- Monthly installment amountcollateralRequired- Boolean for collateral sectioncollateralDescription- Description of collateralschedule[]- Array of repayment schedulepaymentNumber- Payment sequence numberdueDate- Due date for paymentprincipal- Principal componentinterest- Interest componenttotal- Total payment amount
signatureDate- Date for signature
Template Structure:
LOAN AGREEMENT
This Loan Agreement ("Agreement") is made on {{agreementDate}} between:
Lender: BankLingo Financial Services
Borrower: {{customerName}} (ID: {{customerId}})
LOAN DETAILS:
- Loan Amount: ${{loanAmount}}
- Interest Rate: {{interestRate}}% per annum
- Tenure: {{tenure}} months
- Monthly Payment: ${{monthlyPayment}}
{{#if collateralRequired}}
COLLATERAL:
The following collateral is pledged against this loan:
{{collateralDescription}}
{{/if}}
REPAYMENT SCHEDULE:
[TABLE START]
Payment No. | Due Date | Principal | Interest | Total
{{#schedule}}
{{paymentNumber}} | {{dueDate}} | ${{principal}} | ${{interest}} | ${{total}}
{{/schedule}}
[TABLE END]
Signed on: {{signatureDate}}
2. Account Statement Template
File: account-statement-template.docx
Use Case: Monthly statements, transaction history
Context Variables:
bankName- Bank namebankAddress- Bank addresscustomerName- Account holder nameaccountNumber- Account numberstartDate- Statement period startendDate- Statement period endopeningBalance- Opening balanceclosingBalance- Closing balancetotalDebits- Total debits in periodtotalCredits- Total credits in periodnetChange- Net change in balancetransactions[]- Array of transactionsdate- Transaction datedescription- Transaction descriptionamount- Transaction amount (formatted)isDebit- Boolean for debitisCredit- Boolean for creditbalance- Balance after transaction
Template Structure:
{{bankName}}
{{bankAddress}}
ACCOUNT STATEMENT
Account Holder: {{customerName}}
Account Number: {{accountNumber}}
Statement Period: {{startDate}} to {{endDate}}
SUMMARY:
Opening Balance: ${{openingBalance}}
Total Credits: ${{totalCredits}}
Total Debits: ${{totalDebits}}
Net Change: ${{netChange}}
Closing Balance: ${{closingBalance}}
TRANSACTION HISTORY:
[TABLE START]
Date | Description | Debit | Credit | Balance
{{#transactions}}
{{date}} | {{description}} | {{#if isDebit}}${{amount}}{{/if}} | {{#if isCredit}}${{amount}}{{/if}} | ${{balance}}
{{/transactions}}
[TABLE END]
This is a computer-generated statement and does not require a signature.
3. Loan Disbursement Letter
File: loan-disbursement-letter.docx
Use Case: Loan approval notification
Context Variables:
letterDate- Date of lettercustomerName- Customer namecustomerAddress- Customer addressloanApplicationNumber- Application referenceapprovedAmount- Approved loan amountinterestRate- Interest ratetenure- Loan tenuredisbursementDate- Expected disbursement datedisbursementMethod- Method (direct credit/cheque)accountNumber- Disbursement account (if applicable)conditions[]- Array of conditionscondition- Condition text
contactPerson- Bank contact personcontactPhone- Contact phone number
Template Structure:
{{letterDate}}
{{customerName}}
{{customerAddress}}
Dear {{customerName}},
LOAN APPROVAL AND DISBURSEMENT NOTICE
Application Reference: {{loanApplicationNumber}}
We are pleased to inform you that your loan application has been approved with the following terms:
Approved Loan Amount: ${{approvedAmount}}
Interest Rate: {{interestRate}}% per annum
Tenure: {{tenure}} months
Expected Disbursement Date: {{disbursementDate}}
Disbursement Method: {{disbursementMethod}}
{{#if accountNumber}}
Disbursement Account: {{accountNumber}}
{{/if}}
{{#if conditions}}
CONDITIONS:
The following conditions must be met before disbursement:
{{#each conditions}}
{{@index}}. {{this.condition}}
{{/each}}
{{/if}}
Please contact us if you have any questions.
Sincerely,
{{contactPerson}}
{{contactPhone}}
4. Certificate of Deposit
File: certificate-of-deposit.docx
Use Case: Fixed deposit certificates
Context Variables:
certificateNumber- Certificate numberissueDate- Issue datecustomerName- Customer namecustomerId- Customer IDdepositAmount- Deposit amountinterestRate- Interest ratetenure- Deposit tenure in monthsmaturityDate- Maturity datematurityAmount- Amount at maturityaccountNumber- Linked account numberearlyWithdrawalPenalty- Penalty percentagerenewalOption- Auto-renewal option
Template Structure:
CERTIFICATE OF DEPOSIT
Certificate No: {{certificateNumber}}
Issue Date: {{issueDate}}
This certifies that {{customerName}} (ID: {{customerId}}) has deposited:
DEPOSIT AMOUNT: ${{depositAmount}}
TERMS:
- Interest Rate: {{interestRate}}% per annum
- Tenure: {{tenure}} months
- Maturity Date: {{maturityDate}}
- Maturity Amount: ${{maturityAmount}}
- Linked Account: {{accountNumber}}
ADDITIONAL INFORMATION:
- Early Withdrawal Penalty: {{earlyWithdrawalPenalty}}%
- Auto-Renewal: {{renewalOption}}
This certificate is not transferable.
5. Collection Notice
File: collection-notice-template.docx
Use Case: Overdue payment reminders
Context Variables:
noticeDate- Date of noticecustomerName- Customer nameaccountNumber- Account numberloanNumber- Loan referenceoverdueAmount- Total overdue amountdueDate- Original due datedaysPastDue- Number of days overduelateFee- Late fee chargestotalAmountDue- Total amount including feespaymentDeadline- Final payment deadlineconsequences- Consequences of non-paymentpaymentMethods[]- Array of payment methodsmethod- Payment method description
Template Structure:
COLLECTION NOTICE
Date: {{noticeDate}}
To: {{customerName}}
Account Number: {{accountNumber}}
Loan Number: {{loanNumber}}
OVERDUE PAYMENT NOTICE
This is to inform you that your payment is overdue:
Original Due Date: {{dueDate}}
Days Past Due: {{daysPastDue}}
Overdue Amount: ${{overdueAmount}}
Late Fees: ${{lateFee}}
TOTAL AMOUNT DUE: ${{totalAmountDue}}
PAYMENT DEADLINE: {{paymentDeadline}}
CONSEQUENCES OF NON-PAYMENT:
{{consequences}}
PAYMENT METHODS:
{{#each paymentMethods}}
- {{this.method}}
{{/each}}
Please make payment immediately to avoid further action.
For assistance, please contact our collections department.
6. Account Opening Certificate
File: account-opening-certificate.docx
Use Case: Welcome letter for new accounts
Context Variables:
customerName- Customer nameaccountType- Type of accountaccountNumber- Account numberopeningDate- Account opening dateinitialDeposit- Boolean if deposit madedepositAmount- Initial deposit amountbranchName- Branch namebranchCode- Branch codefeatures[]- Array of account featuresfeature- Feature description
contactPerson- Relationship managercontactEmail- Contact emailcontactPhone- Contact phone
Template Structure:
ACCOUNT OPENING CERTIFICATE
Dear {{customerName}},
Welcome to BankLingo! We are pleased to confirm the opening of your account:
ACCOUNT DETAILS:
Account Type: {{accountType}}
Account Number: {{accountNumber}}
Opening Date: {{openingDate}}
Branch: {{branchName}} (Code: {{branchCode}})
{{#if initialDeposit}}
Initial Deposit: ${{depositAmount}}
{{/if}}
ACCOUNT FEATURES:
{{#each features}}
• {{this.feature}}
{{/each}}
Your Relationship Manager:
{{contactPerson}}
Email: {{contactEmail}}
Phone: {{contactPhone}}
Thank you for choosing BankLingo!
7. Loan Pre-Approval Letter
File: loan-pre-approval-letter.docx
Use Case: Pre-qualification notifications
Context Variables:
letterDate- Date of lettercustomerName- Customer namepreApprovedAmount- Pre-approved amountloanType- Type of loanvalidUntil- Pre-approval validity dateinterestRateRange- Interest rate rangenextSteps[]- Array of next stepsstep- Step description
requiredDocuments[]- Array of documents neededdocument- Document name
agentName- Loan officer nameagentContact- Loan officer contact
Template Structure:
{{letterDate}}
Dear {{customerName}},
LOAN PRE-APPROVAL NOTICE
Congratulations! Based on your initial application, you are pre-approved for:
PRE-APPROVED AMOUNT: Up to ${{preApprovedAmount}}
Loan Type: {{loanType}}
Valid Until: {{validUntil}}
Expected Interest Rate: {{interestRateRange}}
NEXT STEPS:
{{#each nextSteps}}
{{@index}}. {{this.step}}
{{/each}}
REQUIRED DOCUMENTS:
{{#each requiredDocuments}}
• {{this.document}}
{{/each}}
This pre-approval is subject to final verification and credit approval.
Your Loan Officer:
{{agentName}}
{{agentContact}}
8. Payment Receipt
File: payment-receipt-template.docx
Use Case: Payment confirmations
Context Variables:
receiptNumber- Receipt numberreceiptDate- Date of receiptcustomerName- Customer nameaccountNumber- Account numberpaymentAmount- Amount paidpaymentMethod- Payment methodreferenceNumber- Transaction referenceappliedTo- What payment was forremainingBalance- Outstanding balancenextDueDate- Next payment due date (if applicable)nextDueAmount- Next payment amount (if applicable)
Template Structure:
PAYMENT RECEIPT
Receipt No: {{receiptNumber}}
Date: {{receiptDate}}
Received from: {{customerName}}
Account Number: {{accountNumber}}
PAYMENT DETAILS:
Amount Paid: ${{paymentAmount}}
Payment Method: {{paymentMethod}}
Reference Number: {{referenceNumber}}
Applied To: {{appliedTo}}
ACCOUNT STATUS:
Remaining Balance: ${{remainingBalance}}
{{#if nextDueDate}}
Next Payment Due: {{nextDueDate}}
Next Payment Amount: ${{nextDueAmount}}
{{/if}}
Thank you for your payment.
This is a computer-generated receipt and does not require a signature.
Creating Your Own Templates
Step 1: Create in Microsoft Word
- Open Microsoft Word
- Design your document with proper formatting
- Add placeholders using
{{variableName}}syntax - Add conditional blocks, loops, or table repetition markers
- Save as
.docxformat
Step 2: Upload to BankLingo
Use the CreateDocumentTemplateDefinitiionCommand or upload through the admin interface.
Step 3: Test Your Template
var result = doCmd('DocumentRenderV2Command', {
Data: {
documentName: 'your-template-name',
context: JSON.stringify({
// Your test data
}),
isPdfOutput: false
}
});
Template Best Practices
-
Use Descriptive Names: Name templates clearly (e.g.,
loan-agreement-template, nottemplate1) -
Format Data Before Passing: Format numbers, dates in your context before passing to template
-
Handle Missing Data: Use conditional blocks for optional sections
-
Test with Real Data: Always test with actual production-like data
-
Version Your Templates: Use version numbers in template names for major changes
-
Document Context Schema: Maintain documentation of required context variables
-
Keep Formatting Simple: Complex Word formatting may not always render perfectly
-
Use Tables for Tabular Data: Tables work better than trying to align text with spaces
Common Issues and Solutions
Issue: Placeholder not replaced
Cause: Variable name mismatch or incorrect syntax Solution: Double-check spelling and ensure context contains the variable
Issue: Conditional block not working
Cause: Context value is not boolean or is undefined
Solution: Ensure condition variable is explicitly true or false
Issue: Table rows not repeating
Cause: Incorrect marker placement or array name mismatch Solution: Verify markers are in separate rows and array name matches context
Issue: Formatting lost
Cause: Complex formatting may not be preserved Solution: Keep formatting simple; test with actual template