Skip to main content

BankLingo Functions Reference

BankLingo provides a comprehensive set of built-in JavaScript functions that are available within the command execution engine. These functions enable you to interact with the banking system, perform secure operations, manage caching, and more.

Function Categories​

🎯 Command Execution​

Execute commands and backend operations

  • doCmd() - Execute custom commands
  • doBackend() - Execute native backend commands

🔐 Security & Credentials​

Manage secure credentials and access control

  • $.secure.get() - Retrieve encrypted credentials
  • hasRole() / requireRole() - Role-based access
  • hasClaim() / requireClaim() - Claims-based access
  • requireAdmin() / requireAnyRole() - Complex authorization
  • getUserRoles() / getUserClaims() / getUserClaimsByType() - Inspect the current identity

💾 Memory Cache​

High-performance in-memory caching with automatic prefixing

  • $.cache.set() - Store values with expiry
  • $.cache.get() - Retrieve cached values
  • $.cache.remove() - Delete cache entries
  • $.cache.exists() - Check cache existence
  • $.cache.getOrSet() - Get or create pattern

🔐 Cryptographic Functions​

Hash and encode data securely

  • sha512() - SHA-512 hashing
  • hmacSha256() - HMAC-SHA256 signing
  • base64Encode() / base64Decode() - Base64 encoding

🔢 Utility Functions​

Mathematical and formatting helpers

  • round() - Precision rounding for currencies
  • numberToWords() - Convert a non-negative number into English words
  • console.log() / console.warn() / console.error() - Formula diagnostics

🧰 Formula Helpers​

Helpers injected into standard command-formula execution

  • Null and object helpers: isNullOrEmpty(), coalesce(), safeGet(), generateUUID()
  • Date helpers: now(), addDays(), diffDays(), formatDate()
  • String helpers: toUpper(), toLower(), trim(), contains(), replaceAll(), slugify()
  • Numeric helpers: round(), toFixed(), percentageOf()
  • Validation helpers: isEmail(), isPhoneNumber(), isNumber(), isDate()
  • Business errors: BpmnError

📊 List and Monitoring Helpers​

Specialized helpers for ExecuteListExpressionAsync

  • Windowed transaction functions: txnCount(), txnSum(), txnAvg()
  • Behavior and anomaly functions: isNewValue(), amountZScore(), isAbovePercentile()
  • Device, merchant, channel, and location analysis functions

🏦 Loan Request ID Generation​

Internal loan-origination utility

  • LoanRequestIdGenerator.Generate() - Creates a readable, unique request ID from the persisted LoanQuote.Id
  • Used automatically by self-service and administrator loan-creation commands
  • Not callable from JavaScript execution-engine scripts

Quick Start Examples​

Execute a Backend Command​

var result = doBackend('GetExistingLoanSchedules', {
accountNumber: 'LN00001234'
});

Use Secure Credentials​

var apiKey = $.secure.get('PAYMENT_GATEWAY_API_KEY');
var response = callExternalAPI(apiKey);

Cache Expensive Operations​

var schedules = $.cache.getOrSet('loan_schedules_' + loanId, function() {
return doCmd('GetExistingLoanSchedules', { loanId: loanId });
}, 300); // Cache for 5 minutes

Compute HMAC Signature​

var signature = hmacSha256('secret_key', 'data_to_sign');

Function Availability​

Availability depends on which JavaScript runtime evaluates the expression:

Execution contextAvailable functions
Command formulas and ExeFormulaBase engine functions plus Formula Helpers
BPMN formula execution through ExecuteFormulaWithLogsAsyncBase engine functions plus Formula Helpers
Monitoring rules through ExecuteListExpressionAsyncBase engine functions plus List and Monitoring Helpers
Dual/reconciliation formulasBase engine functions only
Process-trigger conditionsStandard JavaScript and context only
Browser/client scriptsNo server-side BankLingo functions

Base engine functions include command dispatch, security and identity helpers, cache and secure access, cryptography, numberToWords(), round(), and BpmnError.

Best Practices​

  1. Use caching for expensive operations to improve performance
  2. Validate inputs before passing to backend commands
  3. Handle errors gracefully with try-catch blocks
  4. Use secure storage for sensitive credentials
  5. Test authorization requirements before deploying
  6. Round currency values to avoid floating-point errors

See Also​