Skip to content

openintegrationhub/wicecrm-transformer

Repository files navigation

wice-jsonata-transform-component NPM version Build Status Dependency Status

Dedicated Wice CRM data transformation component for Open Integration Hub platform based on JSONata

Authentication

This component requires no authentication.

How it works

The component supports two actions - Transform to OIH and Transform from OIH. This means that the component takes the incoming message body from the previous step and creates a new expression in a JSON format.

The new generated JSON object has specific properties which represent the input/output for the next/previous component in the flow.

The uses a fact that JSONata expression is a superset of JSON document so that by default any valid JSON document is a valid JSONata expression.

Let's see how the action Transform from OIH works. For example let's take this sample incoming message body from OIH Database component and transform it to a valid Wice object:

{
  "rowid": msg.body.applicationRecordUid,
  "tenant": msg.body.tenant,
  "name": msg.body.lastName,
  "firstname": msg.body.firstName,
  "salutation": msg.body.salutation,
  "birthday": msg.body.birthday
}

The result of that transformation will be the following JSON document:

{
  "rowid": "198562",
  "tenant": "617",
  "name": "Doe",
  "firstname": "John",
  "salutation": "Mr.",
  "date_of_birth": "04.11.1980"
}

The action Transform to OIH works the same way. Let's take this incoming message body from Wice component:

{
  "recordUid": msg.body.rowid,
  "oihLastModified": jsonata("$now()").evaluate(),
  "lastName": msg.body.name,
  "firstName": msg.body.firstname,
  "salutation": msg.body.salutation,
  "birthday": msg.body.birthday,
}

The result of that transofrmation will be the following JSON document:

{
  "recordUid": "198562",
  "oihLastModified": "2018-06-11T09:41:45.679Z",
  "lastName": "Doe",
  "firstName": "John",
  "salutation": "Mr.",
  "birthday": "04.11.1980"
}

License

Apache-2.0 © elastic.io GmbH