Purpose:

Discover if your administrator-facing view has been rendered in the context of an existing transaction request template (in edit mode) or a new transaction request template (in create mode).

If your application is launched in the context of an existing transaction template, this method will return the previously created transactionTemplate object, containing the associated request type and set of request options, which your application user-interface can use to render the applicable view for the administrator (such as pre-filling the form entries).

Otherwise, if your application is launched in the context of a new transaction request template, this method will return a null response.

Sample Usage:

let currentTransactionTemplate = {};

async function getCurrentTransactionTemplate() {
  try {
    const transactionTemplateObject = await elli.script.getObject('transactionTemplate')
    const currentTransactionTemplate = await transactionTemplateObject.get()

    if (currentTransactionTemplate) {
      // Assuming initialize pre-fills the user-interface with the
      // values from the current transaction template - for edit mode
    	initialize(currentTransactionTemplate)
    }
    else {
      // Else - initialize to base state - for create mode
    	initialize();
    }
  } catch (error) {
    console.log({error})
  }
}

getCurrentTransactionTemplate()
elli.script.getObject('transactionTemplate')
  .then(
    (transactionTemplateObject) => {
      transactionTemplateObject.get()
        .then(
          (currentTransactionTemplate) => {
            if (currentTransactionTemplate) {
              // Assuming initialize pre-fills the user-interface with the
              // values from the current transaction template - for edit mode
              initialize(currentTransactionTemplate)
            }
            else {
              // Else - initialize to base state - for create mode
              initialize();
            }
          }
        )
        .catch(
          (error) => {
            console.log({error})
          }
        )
    }
  )
  .catch(
    (error) => {
      console.log({error})
    }
  )

Interface:

Input:

N/A

Returns:

Type: Promise

==> Resolved:

Case 1: When in edit mode for an existing transactionTemplate

{
  name: 'TEMPLATE_NAME',
  request: {
    type: 'SUPPORTED_REQUEST_TYPE',
    options: {
      stringOption: 'SOME_VALUE',
      booleanOption: true,
      numericOption: 1000
    }
  }
}
AttributeDescription

$.name
string

The listed name for the transaction template - as auto-generated, or as provided by the lender administrator when the template was created.

$.request.type
string

The type of transaction request being templated for the subject product. This must be one of the supported values for the request type that your application is configured to support, based on which its data entitlements are scoped.

$.request.options
object

The specific set of selectable options that apply to the specific type of transaction request, as modeled by your application, being templated by the Lender administrator.

This can be used to select from which bureaus to order a borrower's credit score for a Credit integration, or how many days of income information to pull for a borrower in the case of a Verification of Income/Employment integration.

Case 2: When in create mode for a new transactionTemplate

null

==> Rejected:

An error is raised, containing a message attribute with details about the error that occurred

{
  message: "{{ERROR_DETAILS}}"
}

🚧

Not able to retrieve this object?

Remember, the transactionTemplate object is only accessible to the administrator-facing view of a Partner application, registered as the $.adminInterfaceUrl property in the product configuration. This object encapsulates functionality that is only relevant for products that support 1-click/automated ordering workflows (as specified by the $.tags.workflows tag in the product configuration), and is only applicable when an administrator is trying to create a 1-click/automated service ordering setup in the Web Version of Encompass Services Management section.

This object is therefore not accessible to an integration's service ordering views (registered as the $.interfaceUrl property in the product configuration), wherein the transaction and application objects are available for use as applicable.