# 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:*

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/sQGXZ60SlOSnZTftmPk3/baig-updateincident-fields-1.png)

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:*

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/7aSLcLhhmxLRfp7CgxO8/baig-updateincident-fields-2.png)

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*](https://docs.sharelogic.com/unifi/integration-guides/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](https://docs.sharelogic.com/unifi/integration-guides/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'          |
| 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>                   |
| 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]    |
| Element        | The field on the source/target table this Field record is mapped to.                    | 'Additional comments'     |
| 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:*

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/HapDI3ufU0w4Incyd2O7/baig-updateincident-fields-3.png)

**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 %}

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/5czy2T5DJHBP3UymSTcP/baig-updateincident-fields-4.png)

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                       |
| ----------- | --------------------------------------------------------------------------------------- | --------------------------- |
| 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     |
| 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:*

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/FQmC1woVE00BW52foJtO/baig-updateincident-fields-5.png)

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://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/wc6bDP8017iMjBQ0jJK6/v2-fields-updateincident-6.png)

...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:*

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/skfMNfzgvscCuM86K3A0/baig-updateincident-fields-6.png)

Click on **Build Message**.

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

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/sYXJAUt9CwrTg8ojXrDl/v2-fields-updateincident-8.png)

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

*Your Script Editor fields should look like this:*

![](https://content.gitbook.com/content/fbSELbHwB4GcLuDcZMCU/blobs/LtPTR6aV8swRsRJjE73v/baig-updateincident-fields-7.png)

## Message Scripts

{% hint style="info" %}
The newly auto-generated code will appear between a Begin & End Comment immediately prior to any code that may already be there (pre-existing code will be retained).
{% 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.
