---
description: >-
  We will utilise the Field & Field Map records to configure the Message Scripts
  for the UpdateIncident Message.
---

# UpdateIncident Fields

## Field: message.message\_header

{% hint style="info" %}
The 'message\_header' (Integration level) Field record should already be in place _(i.e. with Active set to false)_. We will now create its Message level counterpart.
{% endhint %}

From the **UpdateIncident** Message, navigate to **Message > Fields**.

_Your UpdateIncident Fields page should look like this:_

![](broken-reference)

1\) Find the **message.message\_header** (Integration level) Field & set **Active** to **true**.

{% hint style="success" %}
The 'Build Integration' button becomes visible in the banner and the empty circle icon next to the Field name turns green & contains a green 'check' _(to indicate that Message level configuration exists for this Field)_.  _Note: the empty 'circle icon' indicates that the Integration level Field is available to add to the Message._
{% endhint %}

As before, by setting the Active flag to true on the Integration level Field record listed on the Message, Unifi has automatically created the Message level counterpart.

{% hint style="success" %}
Next, **repeat** the process for the incident.short\_description Field.
{% endhint %}

## Field: incident.short\_description

{% hint style="info" %}
The 'incident.short\_desccription' (Integration level) Field record should already be in place _(i.e. with Active set to false)_. We will now create its Message level counterpart.
{% endhint %}

_Your UpdateIncident Fields page should look like this:_

![](broken-reference)

2\) Find the **incident.short\_description** (Integration level) Field & set **Active** to **true**.

{% hint style="success" %}
The empty circle icon next to the Field name turns green & contains a green 'check' _(to indicate that Message level configuration exists for this Field)_.
{% endhint %}

We will now configure Field records for two other Incident record field elements.

## Fields & Field Maps

As with the CreateIncident Message and depending on your requirements, you will need to create Field records for each of the relevant Incident record field elements _(see the table in_ [_Fields & Field Maps_](../../create-scenario/createincident-fields#fields-and-field-maps) _on the 'CreateIncident Fields' page for an example)_. For the sake of brevity, this Guide will focus on two of those. If you wish, however, you are free to configure other Field records as required.

The table below lists the Incident record field elements we will map and the relevant Field Maps required to configure each Field record.

| Incident Field | Field Map     |
| -------------- | ------------- |
| comments       | Journal field |
| work\_notes    | Journal field |

## Copy Field Maps

If you haven't already, you will need to copy the relevant additional Field Maps for the UpdateIncident Field records as follows:

* Journal field

See [Copy Field Maps](../../create-scenario/createincidentreceipt-fields#copy-field-maps) _(on the 'CreateIncidentReceipt Fields' page)_ for details.

## Field: incident.comments

From the **UpdateIncident** Message, navigaate to **Message > Fields** & click **New**.

The fields to be configured for our incident.comments New Field modal are as follows:

| #  | Field        | Description                                                                             | Value                     |
| -- | ------------ | --------------------------------------------------------------------------------------- | ------------------------- |
| \* | Message      | The Message this Field record is linked with.                                           | 'UpdateIncident'          |
| 3  | Description  | Describe what this field is for and any specific details that might help you in future. | 'The incident's comments' |
| \* | Active       | Set to true to use this Field record for processing.                                    | \<true>                   |
| 4  | Field map    | The Field Map this Field record is linked with.                                         | 'IG Journal field'\*\*    |
| \* | Map to field | Use this Field record to represent a field on a source/target table.                    | \<true>                   |
| \* | Table        | The primary source/target table that this Field record is mapped to.                    | 'Incident' \[incident]    |
| 5  | Element      | The field on the source/target table this Field record is mapped to.                    | 'Additional comments'     |
| 6  | Path         | Where in the payload the data will be placed.                                           | 'detail'                  |
| \* | Property     | The property in the payload the data will be written to.                                | Automatically populated   |
| \* | Inbound      | Set to true to use for inbound Messages.                                                | \<true>                   |
| \* | Outbound     | Set to true to use for outbound Messages.                                               | \<true>                   |

_\*These fields are automatically defaulted to true, or automatically populated._

\*\*Field map: Value may vary. Choose the copy Field Map you created for your Integration.

_Your 'incident.comments' New Field modal should look like this:_

![](broken-reference)

7\) **Submit** the record.

You will be redirected back to the Fields page of the UpdateIncident Message.

## Field: incident.work\_notes

{% hint style="info" %}
Because the incident.work\_notes Field record is the same 'type' _(IG Journal field)_ & the majority of the settings are the same as the previously configured Field, it will be quicker to copy the incident.comments Field & make a few minor changes.
{% endhint %}

![](broken-reference)

8\) Click the **ellipsis** next to the **incident.comments** Field record & click **Copy**.

The fields to edit for the Copy Field modal are as follows:

| #  | Field       | Description                                                                             | Value                       |
| -- | ----------- | --------------------------------------------------------------------------------------- | --------------------------- |
| 9  | Element     | The field on the source/target table this Field record is mapped to.                    | 'Work notes'                |
| \* | Property    | The property in the payload the data will be written to.                                | Automatically populated     |
| 10 | Description | Describe what this field is for and any specific details that might help you in future. | 'The incident's work notes' |

_\*This field is automatically populated._

_Your Copy Field modal should look like this:_

![](broken-reference)

11\) Click **Copy**.

You will be redirected to the Details page of the newly created incident.work\_notes Field record.

## Build

Now that we’ve configured the Field records for the UpdateIncident message, we are ready to build our message scripts.

To quickly navigate to the UpdateIncident Message from the Details page of the newly created incident.work\_notes Field record…

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQxfgO8mw1gUB1Ab5bb%2F-MR0uMeSEmfR6IBeDB1j%2FV2%20-%20Fields%20UpdateIncident%206.png?alt=media\&token=66724f4b-6c6c-44c5-9790-bb799498ec98)

...click the **'Preview' icon** to the left of the Message field.

From the **UpdateIncident** message, navigate to **Message > Fields**.

_The following Field records should now be in place for your UpdateIncident messsage:_

![](broken-reference)

12\) Click on **Build Message**.

You will see the 'Message build successful' Info Message.

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQxfgO8mw1gUB1Ab5bb%2F-MR0uh_l1JD5_2RDsy_s%2FV2%20-%20Fields%20UpdateIncident%208.png?alt=media\&token=543d0aec-d621-4b76-94e0-38f335415c88)

13\) Navigate to **Advanced > Script Editor** to view the auto-generated code.

_Your Script Editor fields should look like this:_

![](broken-reference)

## Message Scripts

{% hint style="info" %}
The newly auto-generated code will appear between a Begin & End Comment immediately prior to any code that was already there.
{% endhint %}

```javascript
//===== [ws] Begin Unifi Auto Generated Code =====//

/*
 * This code (between the Begin and End comments) is generated from the
 * Field and Field mapping records which are configured as part of the integration.
 *
 * All code either above or below the comments will be automatically maintained
 * through the build cycle.
 *
 * WARNING: Do not edit the Begin or End comments.
 */

(New auto-generated code will appear here)

//===== [ws] End Unifi Auto Generated Code =====//

(Old pre-existing code will appear here)
```

We are now ready to **Test** our **UpdateIncident** Message.
