The CreatorCon Call for Content is officially open! Get started here.

How to implement a custom database listener for ServiceNow

pahan
Kilo Explorer

Hi,

I want to get the tickets update events pushed to my application with out polling whole ServiceNow database. Please let me know if there is any event based mechanism inbuilt to ServiceNow which I can leverage.

Thank you in advance.

3 REPLIES 3

BenPhillipsSNC
Kilo Guru

Hi Pahan,



Some tables such as Incident have events that are already generated out-of-box. For example, anytime you update an incident a new event is generated called "incident.updated". It lives in your sysevent table which you can get to via "System Logs > Event Log". What you can do from there is up to you. For example, to integrate with some other system you could even create a business rule on insert of sysevents of name "incident.updated" and fire off a REST message to another system. Lots of possibilities. Depends on what specifically you are looking for.



Thanks


Hi Ben,



Thank you very much for your reply. Yes I checkout the 'Event Log' and it contains all the event details I wanted. So my procedure should be polling the 'Event' table and retrieve relevant event details, if I am not implementing a custom business rule as you mentioned. Please let me know.




Thank you in advance.


You don't have to poll the table from an external system. There's a few ways you can get ServiceNow to send out data when your event happens.



1. You could create a scheduled job in SN that runs every X minutes and if there are new events of your type, it does something like send an email, fire a workflow, or whatever. Creating a Scheduled Job - ServiceNow Wiki



2. You could have an on-insert business rule on your events table that looks for new events of your type being inserted, and if they are, it fires a REST post to your external system with some data.



Outbound REST Web Service - ServiceNow Wiki


REST API call using Business script.



There are many other ways you could probably set it up... those are just some ideas off the top of my head.