Incident creation from Webhook Alerts

Senthil19
Kilo Contributor

I followed the instructions provide in the link below to create a Webhook and sucessfully posted an Alert to the system logs .

https://community.servicenow.com/community?id=community_blog&sys_id=886d2a29dbd0dbc01dcaf3231f9619b0

How do i create an incident for the messages /Alerts received through the webhook.

 

Thanks

Senthil

 

 

1 ACCEPTED SOLUTION

bernyalvarado
Mega Sage

Hi Senthil,

In the scripted API that you created as part of the instructions in that blog... instead of doing a log entry, you actually can create the incident.

How?

It's very simple... just include something like the following before or after where you do the log entry...

var grIncident = new GlideRecord('incident');

grIncident.initialize();

grIncident.short_description = 'Incident created from WebHook';

grIncident.description = request.body.dataString;

//the above is just an example. you can parse the request body and fill up the various incident fields depending on the data that you have in your payload

grIncident.insert();

//and Voila! your Incident is created

 

Thanks,

Berny

 

View solution in original post

8 REPLIES 8

You're welcome Senthil! Indeed, please keep me posted in the outcome. I'll also appreciate if you could mark as helpful those answers that were helpful :P... 

Thanks,

Berny

Senthil19
Kilo Contributor

Hi Berny,

The solution worked like a champ . Appreciate all the help.

You seem to be an expert at it

Regards,

Senthil

 

 

lol! 🙂 thanks for the compliment Senthil! 

You're welcome! I'm very happy you were able to get it working. 

Yash41
Tera Contributor

Hi Berny,

This is not working for me, after adding the suggested attributes. I still do not see an incident created in SNOW.