IEventSender - Global

  • Rversion finale: Australia
  • Mis à jour 12 mars 2026
  • 1 minute de lecture
  • The IEventSender API provides methods to send events from a MID Server to a ServiceNow instance and to query the status of the event queue.

    Before calling any methods within this class, you must call the SNEventSenderProvider.getEventSender() method to instantiate an IEvent object.

    Use the Event API to add/update fields within an event. Use the SNEventSenderProvider API to instantiate an event sender object. Then use the IEventSender API to send the event to a ServiceNow instance.

    You must activate the Event Management (com.glideapp.itom.snac) plugin before attempting to access this API. The Event Management plugin requires a separate subscription and must be activated. This plugin includes demo data and activates related plugins if they are not already active.

    For additional information on event management, see Event Management.

    IEventSender - getQueueSize()

    Returns the size of the event queue.

    Tableau 1. Parameters
    Name Type Description
    None
    Tableau 2. Returns
    Type Description
    Number Size of the event queue.

    If an event queue is not currently implemented, returns "0".

    var event = new Event();
    event.setField("source","SAP Solman");
    event.setField("severity","3");
    event.setField("time_of_event", "2019-18-05 13:12:05");
    event.setField("type", "SAP object");
    event.setField("user", "admin"); // parameter added to additional info section
    
    var eventSender = SNEventSenderProvider.getEventSender();
    var sendStatus = eventSender.sendEvent(event); //send event     
    var queueSize = eventSender.getQueueSize() // check the size of the event queue

    IEventSender - isFullQueue()

    Checks if the event queue has exceeded its maximum size.

    Tableau 3. Parameters
    Name Type Description
    None
    Tableau 4. Returns
    Type Description
    Boolean Flag that indicates whether the event queue has exceeded its maximum size. When this happens, no additional event messages can be queued until the queue decreases in size.
    Valid values:
    • true: Event queue is full.
    • false: Event queue is not full and can add more event entries.
    var eventSender = SNEventSenderProvider.getEventSender();
    if (!eventSender.isFullQueue()) // If queue is not full, send event
      eventSender.sendEvent(event);     
    

    IEventSender - sendEvent(Object event)

    Places the specified event in the event queue.

    Tableau 5. Parameters
    Name Type Description
    event IEventSender Event object to place in the events queue.
    Tableau 6. Returns
    Type Description
    Boolean Flag that indicates whether the event was successfully queued
    Valid values:
    • true: Event was queued
    • false: Error
    var eventSender = SNEventSenderProvider.getEventSender();
    eventSender.sendEvent(event); //send event