Editing Scripts

Writing, deploying, and managing JavaScript scripts that automate tasks in ConcordLink.

The Scripts tab is where your organization manages the custom logic that powers automated processes in ConcordLink. Scripts are written in JavaScript and can be run manually, scheduled, or triggered by system events.

Script types

TypeDescription
CalculatedFieldsDerives computed values on accounts or obligations.
PaymentControls how incoming payments are spread across balances.
InstallmentGenerationGenerates installment journals for obligations.
StatementGenerationProduces account statements.
GeneralStandalone scripts for specific actions like creating deferments or generating payoff quotes.
LibraryShared utility files imported by other scripts (for example, helpers.js, formatters.js).

Opening and editing a script

  1. Select the pencil (edit) icon next to the script, or select the script name directly.
  2. The script editor opens with four tabs:
TabPurpose
ScriptThe JavaScript code editor — this is where logic lives.
ContextShows the data available to the script at runtime.
TypingsType definitions for available objects and functions.
PreviewSimulate the script output before deploying.
  1. Make your edits in the Script tab.
  2. Use the buttons at the bottom to validate and deploy:
ButtonFunction
Run TestsExecutes any defined test cases against the script.
PreviewShows a simulated output without committing changes.
RunExecutes the script once manually.
Run AllRuns the script across all applicable records.
Scripts list
Figure Scripts list — view, edit, or add scripts for a product.

Blueprint script inheritance and overrides

When a product inherits a script from a blueprint (shown with an Inherited badge), you no longer have to copy the script by hand to change its behavior on the child product. Directly from the inheriting product, you can:

This replaces the previous copy-by-hand workaround, where taking control of an inherited script meant manually duplicating it and re-creating its tests. Use enable/disable or adjust when you only need a small product-specific variation; use take full control when the product needs to own and evolve the script independently.

Adding a new script

  1. From the Scripts list, select + Add in the top-right corner.
  2. Select the script type from the dropdown.
  3. Name the script and begin writing your logic in the editor.
  4. Use the Context and Typings tabs to reference available data fields.
  5. Run tests and preview before deploying.

Actions

Actions are configurable, JavaScript-driven automations that perform multiple tasks on an account in a single selection. Examples include:

ActionWhat it does
Credit disbursementChanges account status, posts a note, increases the original loan amount, and adds a balance to the principal ledger.
Order statementsTriggers a statement to be generated and posted to the account.
Some actions display a warning or confirmation prompt before executing to prevent accidental changes. Actions can be customized per client portfolio to automate any combination of tasks.

Script structure

The script must return an object with context. It can also optionally include allowPhysical:

function main(context) {
    return {
        context: {
            'DOCUMENTREF': 'ALWAYS.PROVIDE.REF',
            'FIELDINTEMPLATE': 'Static value.\nFields support newline codes!',
            'ANOTHERFIELD': 'Combine static text and fields/code using ' + context.obligation.accountNumber,
            'LASTONE': `Or use backticks and evaluation: ${context.client.name} is rendered.`
        },
        allowPhysical: !context.obligation.hasAutopay
    };
}

Common context fields

DataPath
Obligation account numbercontext.obligation.accountNumber
Principal balancecontext.obligation.ledgers.principal.balance
Interest ratecontext.obligation.rate
Lender namecontext.lender.name
Client namecontext.client.name
Custom data fieldcontext.obligation.data.yourFieldName
Product documentscontext.documents

Referencing Product Documents

Scripts that create jobs or actions can now reference the parent product's document templates via the document context. Use context.documents to look up a template by key or name and attach the resulting document to the job or action you're creating from the script.

Typical uses:

Confirm the exact shape available in the Typings tab before shipping — the tab reflects the current context schema, including the newly available document context.

Tips

Back to: Administrator Tasks and Actions