---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# TroubleTicketNotificationUtilOOB - Scoped

# TroubleTicketNotificationUtilOOB - Scoped {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 7 minutes to read

The TroubleTicketNotificationUtilOOB script include provides methods used to define and generate the TMF-compliant payloads for trouble ticket notification events.  
Override the methods in this script include to:

* Add/remove attributes to an existing trouble ticket event type.
* Define attributes for a new trouble ticket event type.

For additional information, see [Configure trouble ticket notifications using the Producer Event Notification Framework](https://servicenow-prod.fluidtopics.net/OHg_M9MR5_TyjdNhEkNurQ "The base implementation of trouble ticket notification includes a set of trouble ticket events to demonstrate the capabilities of the system.").

This script include runs within the `sn_ind_tsm_sdwan` namespace.

The calling user must have the ticket_integrator role.

## TroubleTicketNotificationUtilOOB - addAdditionalEventAttributes(Object tmfEventPayload) {#ariaid-title2}

Adds custom event header attributes to the passed TMF trouble ticket event payload. The attributes added by this method are added to the event-level header for all trouble ticket events.
{#TTNUO-addAddEvtAtt_O__table_fz3_bnc_d1c__entry__3}

| Name | Type | Description |
|-|-|-|
| tmfEventPayload | Object | TMF-compliant trouble ticket event payload. For details on the format of this event payload, see the [TMF621 Trouble Ticket Management API REST Specification v5.0.0](https://www.tmforum.org/resources/standard/tmf621-trouble-ticket-management-api-rest-specification-v5-0-0/) and the [TMF688 Event Management API User Guide v4.0.0](https://www.tmforum.org/resources/standard/tmf688-event-management-api-user-guide-v4-0-0/). |
[Table 1. Parameters]

{#TTNUO-addAddEvtAtt_O__table_fz3_bnc_d1c} {#TTNUO-addAddEvtAtt_O__table_gz3_bnc_d1c__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#TTNUO-addAddEvtAtt_O__table_gz3_bnc_d1c}  
The following code example shows how to call this method.

    constructTMFEvent: function(eventId) {
      var troubleTicketEvent = {};
      if (gs.nil(eventId)) {
        troubleTicketEvent.eventId = gs.generateGUID();
      } else {
        troubleTicketEvent.eventId = eventId;
      }
      troubleTicketEvent['@type'] = Constants.EVENT_TYPE_TROUBLE_TICKET;
      this.addAdditionalEventAttributes(troubleTicketEvent);
      return troubleTicketEvent;
    },

## TroubleTicketNotificationUtilOOB - constructTMFEvent(String eventId) {#ariaid-title3}

Generates the TMF688-compliant header attributes in the event section of the payload. These attributes are consistent across all event payloads.
In the default implementation, this method adds the eventId and the @type header attributes.

This method calls the helper method [addAdditionalEventAttributes()](https://servicenow-prod.fluidtopics.net/49rI6TtTOW4xEw2bFabuCQ#TTNUO-addAddEvtAtt_O "Adds custom event header attributes to the passed TMF trouble ticket event payload. The attributes added by this method are added to the event-level header for all trouble ticket events."). In this method you can add other header attributes to the event payload. For details, see [Modify a trouble ticket event payload](https://servicenow-prod.fluidtopics.net/uqVOfn_nuRqRb396sD11JA "The base trouble ticket event notification implementation provides multiple default trouble ticket event type examples. You may need to alter the payloads for these events within your implementation to meet your actual needs. You may also need to configure the payload for any new trouble ticket events that you add to your implementation.").
{#TTNUO-constructTMFEvent_S__table_ayr_mjx_c1c__entry__3}

| Name | Type | Description |
|-|-|-|
| eventId | String | Unique identifier of the associated event. This can be any unique value. In the default implementation, if you don't pass the event ID, the value is set to a system generated GUID. |
[Table 3. Parameters]

{#TTNUO-constructTMFEvent_S__table_ayr_mjx_c1c} {#TTNUO-constructTMFEvent_S__table_byr_mjx_c1c__entry__2}

| Type | Description |
|-|-|
| Object | TMF payload with the event-level attributes set. For details on the format of this event payload, see the[TMF688 Event Management API User Guide v4.0.0](https://www.tmforum.org/resources/standard/tmf688-event-management-api-user-guide-v4-0-0/). |
[Table 4. Returns]

{#TTNUO-constructTMFEvent_S__table_byr_mjx_c1c}  
The following code example shows how to call this method to construct the event header attributes when generating a trouble ticket attribute change payload.

    generateTroubleTicketAttributeChangePayload: function(incidentGr, eventType, eventId) {
      var tmfEventPayload = this.constructTMFEvent(eventId);
      tmfEventPayload.eventType = eventType;
      tmfEventPayload.event = this.addAttributeChangeTroubleTicketAttributes(incidentGr);

      return tmfEventPayload;
    },

## TroubleTicketNotificationUtilOOB - generateCreateTroubleTicketEventPaylaod(Object incidentGr, String eventType, String eventId) {#ariaid-title4}

Constructs the TMF-compliant payload for the associated create trouble ticket for incident event type.
This method is executed when the associated event type is `TROUBLE_TICKET_CREATE: "TroubleTicketCreateEvent"`. This method calls two helper methods:

* [constructTMFEvent()](https://servicenow-prod.fluidtopics.net/49rI6TtTOW4xEw2bFabuCQ#TTNUO-constructTMFEvent_S "Generates the TMF688-compliant header attributes in the event section of the payload. These attributes are consistent across all event payloads."): Adds the event header attributes (TMF688) to the payload.
* addCreateTroubleTicketAttributes(): Override this method to add trouble ticket attributes (TMF621), both mandatory and optional, to the payload. This method is just a stub in the default implementation.

You can override these helper methods in the TroubleTicketNotificationUtil script include to configure both event header and trouble ticket attributes in the TMF-compliant
payload.
{#TTNUO-genCreateTTEvtPay_O_S_S__table_i5j_xcx_c1c__entry__3}{#TTNUO-genCreateTTEvtPay_O_S_S__TTNUO-incidentGr-entry}{#TTNUO-genCreateTTEvtPay_O_S_S__TTNUO-eventId-entry}

| Name | Type | Description |
|-|-|-|
| incidentGr | Object | JSON formatted glide record that caused the trouble ticket event to be generated. Use the information in this glide record to construct the TMF621-compliant trouble ticket event payload. |
| eventType | String | Unique identifier of the associated trouble ticket event type. For the default implementation of this method, this should always be `"TroubleTicketCreateEvent"`. For a list of all base trouble ticket event types, refer to <var class="keyword varname">Constants.EVENT_TYPES</var> in the sn_api_notif_mgmt.Constants script include file. |
| eventId | String | Unique identifier of the associated event. |
[Table 5. Parameters]

{#TTNUO-genCreateTTEvtPay_O_S_S__table_i5j_xcx_c1c} {#TTNUO-genCreateTTEvtPay_O_S_S__table_j5j_xcx_c1c__entry__2}{#TTNUO-genCreateTTEvtPay_O_S_S__TTNUO-return-entry}

| Type | Description |
|-|-|
| Object | TMF-compliant trouble ticket event payload. For details on the format of this event payload, see the [TMF621 Trouble Ticket Management API REST Specification v5.0.0](https://www.tmforum.org/resources/standard/tmf621-trouble-ticket-management-api-rest-specification-v5-0-0/) and the [TMF688 Event Management API User Guide v4.0.0](https://www.tmforum.org/resources/standard/tmf688-event-management-api-user-guide-v4-0-0/). |
[Table 6. Returns]

{#TTNUO-genCreateTTEvtPay_O_S_S__table_j5j_xcx_c1c}  
The following code example shows how to call this method.

    fetchEventHandlerAndCreateTMFEvent: function(eventSnapshot, eventType, eventId) {
      var eventPayload;
      switch (eventType) {
        case Constants.EVENT_TYPES.TROUBLE_TICKET_STATUS_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketStatusChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaod(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_ATTRIBUTE_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketAttributeChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE_FOR_CASE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaodForCase(eventSnapshot, eventType, eventId);
          break;

        default:
          this._logger.debug("Event with id " + eventId + " could not find the matching payload generator");
          eventPayload = null;
      }
    return eventPayload;
    },

## TroubleTicketNotificationUtilOOB - generateCreateTroubleTicketEventPaylaodForCase(Object incidentGr, String eventType, String eventId) {#ariaid-title5}

Constructs the TMF-compliant payload for the associated create trouble ticket for case event type.
This method is executed when the associated event type is `TROUBLE_TICKET_CREATE_FOR_CASE: "TroubleTicketCreateEventForCase"`. This method calls two helper methods:

* [constructTMFEvent()](https://servicenow-prod.fluidtopics.net/49rI6TtTOW4xEw2bFabuCQ#TTNUO-constructTMFEvent_S "Generates the TMF688-compliant header attributes in the event section of the payload. These attributes are consistent across all event payloads."): Adds the event attributes (TMF688) to the payload.
* addCreateTroubleTicketAttributesForCase(): Override this method to add trouble ticket attributes (TMF621), both mandatory and optional, to the payload. This method is just a stub in the default implementation.

You can override these helper methods in the TroubleTicketNotificationUtil script include to configure both event header and trouble ticket attributes in the TMF-compliant
payload.
{#TTNUO-genCreateTTEvtPayCase_O_S_S__table_i5j_xcx_c1c__entry__3}{#TTNUO-genCreateTTEvtPayCase_O_S_S__TTNUO-incidentGr-entry}{#TTNUO-genCreateTTEvtPayCase_O_S_S__TTNUO-eventId-entry}

| Name | Type | Description |
|-|-|-|
| incidentGr | Object | JSON formatted glide record that caused the trouble ticket event to be generated. Use the information in this glide record to construct the TMF621-compliant trouble ticket event payload. |
| eventType | String | Unique identifier of the associated trouble ticket event type. For the default implementation of this method, this should always be `"TroubleTicketCreateEvent"`. For a list of all base trouble ticket event types, refer to <var class="keyword varname">Constants.EVENT_TYPES</var> in the sn_api_notif_mgmt.Constants script include file. |
| eventId | String | Unique identifier of the associated event. |
[Table 7. Parameters]

{#TTNUO-genCreateTTEvtPayCase_O_S_S__table_i5j_xcx_c1c} {#TTNUO-genCreateTTEvtPayCase_O_S_S__table_j5j_xcx_c1c__entry__2}{#TTNUO-genCreateTTEvtPayCase_O_S_S__TTNUO-return-entry}

| Type | Description |
|-|-|
| Object | TMF-compliant trouble ticket event payload. For details on the format of this event payload, see the [TMF621 Trouble Ticket Management API REST Specification v5.0.0](https://www.tmforum.org/resources/standard/tmf621-trouble-ticket-management-api-rest-specification-v5-0-0/) and the [TMF688 Event Management API User Guide v4.0.0](https://www.tmforum.org/resources/standard/tmf688-event-management-api-user-guide-v4-0-0/). |
[Table 8. Returns]

{#TTNUO-genCreateTTEvtPayCase_O_S_S__table_j5j_xcx_c1c}  
The following code example shows how to call this method.

    fetchEventHandlerAndCreateTMFEvent: function(eventSnapshot, eventType, eventId) {
      var eventPayload;
      switch (eventType) {
        case Constants.EVENT_TYPES.TROUBLE_TICKET_STATUS_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketStatusChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaod(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_ATTRIBUTE_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketAttributeChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE_FOR_CASE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaodForCase(eventSnapshot, eventType, eventId);
          break;

        default:
          this._logger.debug("Event with id " + eventId + " could not find the matching payload generator");
          eventPayload = null;
      }
    return eventPayload;
    },

## TroubleTicketNotificationUtilOOB - generateTroubleTicketAttributeChangePayload(Object incidentGr, String eventType, String eventId) {#ariaid-title6}

Constructs the TMF-compliant payload for the trouble ticket attribute change event for incident event type.
This method is executed when the associated event type is `TROUBLE_TICKET_ATTRIBUTE_CHANGE: "TroubleTicketAttributeChangeEvent"`. This method calls two helper methods:

* [constructTMFEvent()](https://servicenow-prod.fluidtopics.net/49rI6TtTOW4xEw2bFabuCQ#TTNUO-constructTMFEvent_S "Generates the TMF688-compliant header attributes in the event section of the payload. These attributes are consistent across all event payloads."): Adds the event attributes (TMF688) to the payload.
* addAttributeChangeTroubleTicketAttributes(): Override this method to add trouble ticket attributes (TMF621), both mandatory and optional, to the payload. This method is just a stub in the default implementation.

You can override these helper methods in the TroubleTicketNotificationUtil script include to configure both event header and trouble ticket attributes in the TMF-compliant
payload.
{#TTNUO-genTTAttChgPay_O_S_S__table_i5j_xcx_c1c__entry__3}{#TTNUO-genTTAttChgPay_O_S_S__TTNUO-incidentGr-entry}{#TTNUO-genTTAttChgPay_O_S_S__TTNUO-eventId-entry}

| Name | Type | Description |
|-|-|-|
| incidentGr | Object | JSON formatted glide record that caused the trouble ticket event to be generated. Use the information in this glide record to construct the TMF621-compliant trouble ticket event payload. |
| eventType | String | Unique identifier of the associated trouble ticket event type. For the default implementation of this method, this should always be `"TroubleTicketCreateEvent"`. For a list of all base trouble ticket event types, refer to <var class="keyword varname">Constants.EVENT_TYPES</var> in the sn_api_notif_mgmt.Constants script include file. |
| eventId | String | Unique identifier of the associated event. |
[Table 9. Parameters]

{#TTNUO-genTTAttChgPay_O_S_S__table_i5j_xcx_c1c} {#TTNUO-genTTAttChgPay_O_S_S__table_j5j_xcx_c1c__entry__2}{#TTNUO-genTTAttChgPay_O_S_S__TTNUO-return-entry}

| Type | Description |
|-|-|
| Object | TMF-compliant trouble ticket event payload. For details on the format of this event payload, see the [TMF621 Trouble Ticket Management API REST Specification v5.0.0](https://www.tmforum.org/resources/standard/tmf621-trouble-ticket-management-api-rest-specification-v5-0-0/) and the [TMF688 Event Management API User Guide v4.0.0](https://www.tmforum.org/resources/standard/tmf688-event-management-api-user-guide-v4-0-0/). |
[Table 10. Returns]

{#TTNUO-genTTAttChgPay_O_S_S__table_j5j_xcx_c1c}  
The following code example shows how to call this method.

    fetchEventHandlerAndCreateTMFEvent: function(eventSnapshot, eventType, eventId) {
      var eventPayload;
      switch (eventType) {
        case Constants.EVENT_TYPES.TROUBLE_TICKET_STATUS_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketStatusChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaod(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_ATTRIBUTE_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketAttributeChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE_FOR_CASE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaodForCase(eventSnapshot, eventType, eventId);
          break;

        default:
          this._logger.debug("Event with id " + eventId + " could not find the matching payload generator");
          eventPayload = null;
      }
    return eventPayload;
    },

## TroubleTicketNotificationUtilOOB - generateTroubleTicketStatusChangePayload(Object incidentGr, String eventType, String eventId) {#ariaid-title7}

Constructs the TMF-compliant payload for the associated trouble ticket status change event for incident event type.
This method is executed when the associated event type is `TROUBLE_TICKET_STATUS_CHANGE: "TroubleTicketStatusChangeEvent"`. This method calls two helper methods:

* [constructTMFEvent()](https://servicenow-prod.fluidtopics.net/49rI6TtTOW4xEw2bFabuCQ#TTNUO-constructTMFEvent_S "Generates the TMF688-compliant header attributes in the event section of the payload. These attributes are consistent across all event payloads."): Adds the event attributes (TMF688) to the payload.
* addStatusChangeTroubleTicketAttributes(): Override this method to add trouble ticket attributes (TMF621), both mandatory and optional, to the payload. This method is just a stub in the default implementation.

You can override these helper methods in the TroubleTicketNotificationUtil script include to configure both event header and trouble ticket attributes in the TMF-compliant
payload.
{#TTNUO-genTTStatChgPay_O_S_S__table_i5j_xcx_c1c__entry__3}{#TTNUO-genTTStatChgPay_O_S_S__TTNUO-incidentGr-entry}{#TTNUO-genTTStatChgPay_O_S_S__TTNUO-eventId-entry}

| Name | Type | Description |
|-|-|-|
| incidentGr | Object | JSON formatted glide record that caused the trouble ticket event to be generated. Use the information in this glide record to construct the TMF621-compliant trouble ticket event payload. |
| eventType | String | Unique identifier of the associated trouble ticket event type. For the default implementation of this method, this should always be `"TroubleTicketCreateEvent"`. For a list of all base trouble ticket event types, refer to <var class="keyword varname">Constants.EVENT_TYPES</var> in the sn_api_notif_mgmt.Constants script include file. |
| eventId | String | Unique identifier of the associated event. |
[Table 11. Parameters]

{#TTNUO-genTTStatChgPay_O_S_S__table_i5j_xcx_c1c} {#TTNUO-genTTStatChgPay_O_S_S__table_j5j_xcx_c1c__entry__2}{#TTNUO-genTTStatChgPay_O_S_S__TTNUO-return-entry}

| Type | Description |
|-|-|
| Object | TMF-compliant trouble ticket event payload. For details on the format of this event payload, see the [TMF621 Trouble Ticket Management API REST Specification v5.0.0](https://www.tmforum.org/resources/standard/tmf621-trouble-ticket-management-api-rest-specification-v5-0-0/) and the [TMF688 Event Management API User Guide v4.0.0](https://www.tmforum.org/resources/standard/tmf688-event-management-api-user-guide-v4-0-0/). |
[Table 12. Returns]

{#TTNUO-genTTStatChgPay_O_S_S__table_j5j_xcx_c1c}  
The following code example shows how to call this method.

    fetchEventHandlerAndCreateTMFEvent: function(eventSnapshot, eventType, eventId) {
      var eventPayload;
      switch (eventType) {
        case Constants.EVENT_TYPES.TROUBLE_TICKET_STATUS_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketStatusChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaod(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_ATTRIBUTE_CHANGE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateTroubleTicketAttributeChangePayload(eventSnapshot, eventType, eventId);
          break;

        case Constants.EVENT_TYPES.TROUBLE_TICKET_CREATE_FOR_CASE:
          eventPayload = new sn_ind_tsm_sdwan.TroubleTicketNotificationUtil().generateCreateTroubleTicketEventPaylaodForCase(eventSnapshot, eventType, eventId);
          break;

        default:
          this._logger.debug("Event with id " + eventId + " could not find the matching payload generator");
          eventPayload = null;
      }
    return eventPayload;
    },


