Skip to main content

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 agreement
  • customerName - Customer full name
  • customerId - Customer ID
  • loanAmount - Loan principal amount
  • interestRate - Annual interest rate
  • tenure - Loan tenure in months
  • monthlyPayment - Monthly installment amount
  • collateralRequired - Boolean for collateral section
  • collateralDescription - Description of collateral
  • schedule[] - Array of repayment schedule
    • paymentNumber - Payment sequence number
    • dueDate - Due date for payment
    • principal - Principal component
    • interest - Interest component
    • total - 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 name
  • bankAddress - Bank address
  • customerName - Account holder name
  • accountNumber - Account number
  • startDate - Statement period start
  • endDate - Statement period end
  • openingBalance - Opening balance
  • closingBalance - Closing balance
  • totalDebits - Total debits in period
  • totalCredits - Total credits in period
  • netChange - Net change in balance
  • transactions[] - Array of transactions
    • date - Transaction date
    • description - Transaction description
    • amount - Transaction amount (formatted)
    • isDebit - Boolean for debit
    • isCredit - Boolean for credit
    • balance - 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 letter
  • customerName - Customer name
  • customerAddress - Customer address
  • loanApplicationNumber - Application reference
  • approvedAmount - Approved loan amount
  • interestRate - Interest rate
  • tenure - Loan tenure
  • disbursementDate - Expected disbursement date
  • disbursementMethod - Method (direct credit/cheque)
  • accountNumber - Disbursement account (if applicable)
  • conditions[] - Array of conditions
    • condition - Condition text
  • contactPerson - Bank contact person
  • contactPhone - 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 number
  • issueDate - Issue date
  • customerName - Customer name
  • customerId - Customer ID
  • depositAmount - Deposit amount
  • interestRate - Interest rate
  • tenure - Deposit tenure in months
  • maturityDate - Maturity date
  • maturityAmount - Amount at maturity
  • accountNumber - Linked account number
  • earlyWithdrawalPenalty - Penalty percentage
  • renewalOption - 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 notice
  • customerName - Customer name
  • accountNumber - Account number
  • loanNumber - Loan reference
  • overdueAmount - Total overdue amount
  • dueDate - Original due date
  • daysPastDue - Number of days overdue
  • lateFee - Late fee charges
  • totalAmountDue - Total amount including fees
  • paymentDeadline - Final payment deadline
  • consequences - Consequences of non-payment
  • paymentMethods[] - Array of payment methods
    • method - 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 name
  • accountType - Type of account
  • accountNumber - Account number
  • openingDate - Account opening date
  • initialDeposit - Boolean if deposit made
  • depositAmount - Initial deposit amount
  • branchName - Branch name
  • branchCode - Branch code
  • features[] - Array of account features
    • feature - Feature description
  • contactPerson - Relationship manager
  • contactEmail - Contact email
  • contactPhone - 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 letter
  • customerName - Customer name
  • preApprovedAmount - Pre-approved amount
  • loanType - Type of loan
  • validUntil - Pre-approval validity date
  • interestRateRange - Interest rate range
  • nextSteps[] - Array of next steps
    • step - Step description
  • requiredDocuments[] - Array of documents needed
    • document - Document name
  • agentName - Loan officer name
  • agentContact - 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 number
  • receiptDate - Date of receipt
  • customerName - Customer name
  • accountNumber - Account number
  • paymentAmount - Amount paid
  • paymentMethod - Payment method
  • referenceNumber - Transaction reference
  • appliedTo - What payment was for
  • remainingBalance - Outstanding balance
  • nextDueDate - 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

  1. Open Microsoft Word
  2. Design your document with proper formatting
  3. Add placeholders using {{variableName}} syntax
  4. Add conditional blocks, loops, or table repetition markers
  5. Save as .docx format

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

  1. Use Descriptive Names: Name templates clearly (e.g., loan-agreement-template, not template1)

  2. Format Data Before Passing: Format numbers, dates in your context before passing to template

  3. Handle Missing Data: Use conditional blocks for optional sections

  4. Test with Real Data: Always test with actual production-like data

  5. Version Your Templates: Use version numbers in template names for major changes

  6. Document Context Schema: Maintain documentation of required context variables

  7. Keep Formatting Simple: Complex Word formatting may not always render perfectly

  8. 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

See Also