CreateIncidentResponse Fields

We will utilise the Field & Field Map records to configure the Message Scripts for the CreateIncidentResponse Message.

Copy Field Maps

It is worth copying all relevant OOTB Field Maps as are necessary for your integration before using any of them in your Field Records - thereby mitigating the risk of any potential issues with future upgrades.

The Field Map we shall use for our CreateIncidentResponse Field record is:

  • Source Reference

To copy the Source Reference Field Map, navigate to the 'Field Maps' icon.

1) Click on the ellipsis to the right of the Source Reference Field Map & click Copy.

Copy Field Map Modal

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

#

Field

Description

Value

2

Name*

The name of your field map. (If left unedited, it will append the word 'Copy' to the existing name.)

<Your Name>

*Name: We have chosen to prefix the existing Field Map Name with the initials of our Integration (you are free to choose any appropriate means of identifying/differentiating your copy).

Your Copy Field Map modal should look like this:

Integration should be automatically populated.

3) Click Copy.

You will be redirected to the Details page of the newly created Field Map.

Field: result.sys_id

In Unifi Integration Designer, from the CreateIncidentResponse page, navigate to Message > Fields. Click New.

The fields to be configured for the sys_id New Field modal are as follows:

#

Field

Description

Value

*

Message

The Message this Field record is linked with.

'CreateIncidentResponse'

4

Description

Describe what this field is for and any specific details that might help you in future.

'Extract returned sys_id & store in stage.external_reference'

*

Active

Set to true to use this Field record for processing.

<true>

5

Field map

The Field Map this Field record is linked with.

'PI - Source Reference'**

6*

Map to field

Use this Field record to represent a field on a source/target table.

<false>

7

Path

Where in the payload the data will be placed.

'result'

8

Property*

The property in the payload the data will be written to.

'sys_id'

*

Inbound

Set to true to use for inbound Messages.

<true>

9*

Outbound

Set to true to use for outbound Messages.

<false>

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

*Property: We are setting 'sys_id' as the property because that is what is required by the table API. If it were possible, it would better to use something more meaningful, like the Number of the ticket integrated with, as this aids in debugging.

The 'result.sys_id' New Field modal should look like this:

10) Submit the record.

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

Build

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

The following Field record should now be in place for your CreateIncidentResponse messsage:

Feature Alert: In the picture above you will notice that a 'Build Integration' button has appeared in the banner at the top of the page. Whenever a change is made to a Field record that is associated to a Message (whether that is being created, updated, or deleted) the button will be available and acts as a visual reminder that changes have been made and Message Script(s) need to be built. We will talk more about this feature in the Build Integration Level page.

11) Navigate to Advanced > Script Editor.

When you first open the Script Editor, you will see the following:

Having visibility of your message scripts in the one pane makes scripting so much more efficient.

12) Click on Build Message.

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

Your Script Editor fields should now look like this:

You can click View to adjust the layout and change the view to show various combinations of, or individual script fields.

Message Scripts

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).

//===== [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 will now examine our new, auto-generated Message Script.

Payload to Stage:

//===== [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.
*/
x_snd_eb.ws_console.checkpoint("MessageScript")
x_snd_eb.ws_console.execute("Mapping result.sys_id [x_snd_eb_field.do?sys_id=a163e73e1b11b81090dfdb9ebd4bcbdc]", function () {
log.debug("Field map: PI - Source Reference [x_snd_eb_field_map.do?sys_id=eca02f3e1b11b81090dfdb9ebd4bcb63]");
payload = payload || {};
payload.result = payload.result || {};
var $payload = payload.result;
stage.external_reference = '' + ($payload.sys_id || '');
});
var error = x_snd_eb.ws_console.findCheckpointError("MessageScript");
if (error) throw error.message;
//===== [ws] End Unifi Auto Generated Code =====//

Both the stage & bond external reference are being set to the sys id only because we are integrating with the table API and that's what it requires. If possible, it is better to use something more meaningful, like the Number of the ticket integrated with, as this aids in debugging.

Once you have finished examining the code, click 'Close' to navigate back to the Fields page of the CreateIncidentResponse Message.

Next, we will configure the CreateIncident Message.