Add a business rule for a new trouble ticket event

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 2분
  • When adding a new trouble ticket event to your implementation, you must add a business rule to your ServiceNow instance.

    This business rule must push the Glide snapshot of the corresponding incident or case record into the Producer Notification Framework inbound queue, Inbound Queue [sn_tmt_core_inbound_queue] table, where it is then processed and published by the Producer Notification Framework.

    The following code snippet shows an example of a business rule for processing the ResolveTroubleTicketEventForIncident ticket notification event on the Incident [incident] table. When calling the pushEventsToQueue() method to push the event onto the inbound queue, you must pass the event type. For this example it is ResolveTroubleTicketEventForIncident. This event type can be any alphanumeric value that you want, but it must be unique as it is used by the system to determine how to process the trouble ticket event. The list of event types for the base system are defined in the Constants.EVENT_TYPES object in the Constants [sn_api_notif_mgmt.Constants] script include.

    For details on creating a business rule, see Create a business rule for your service.

    // Add following lines of code in script section (Advanced tab) of BR for pushing ‘ResolveTroubleTicketEventForIncident’ to the inbound queue.
    
    (function executeRule(current, previous /*null when async*/ ) {
    
    // Note that event needs to be passed at BR level itself as after this step, we would be left with glide snapshot only
    
    new TroubleTicketNotificationUtil().pushEventsToQueue(current,'ResolveTroubleTicketEventForIncident', Constants.TROUBLE_TICKET_TYPE.INCIDENT);
    
    })(current, previous)