- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 08:47 PM
Is it possible to create an Incident, when a specific Event occurs? If Event 'integration.send_warning' triggers, create an Incident. And add the following values to the Incident:
Description = Parm 1 of the Event
Short description = Download Activity Alert
Assigned Group = Download Activity Alert
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 12:02 PM
Hi @MStritt,
There is no need to create a Script Include for this, you can add the script in the Script Action.
Try the following script:
var incGr = new GlideRecord('incident');
incGr.initialize();
incGr.setValue('description', event.parm1.toString());
incGr.setValue('short_description', 'Download Activity Alert');
incGr.setDisplayValue('assignment_group', 'Download Activity Alert');
incGr.insert();
Note that you are using the display value of the assignment group. This may change in the future, so you may want to consider using the sys_id instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 11:13 AM
Hi Sarthak,
For the Conditions (When to run), don't I also have to name the event?
Name is 'name of event'
AND
State is processed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 11:15 AM - edited 04-16-2024 11:16 AM
Hi @MStritt ,
Yes Yes Yes, you can definetly give
Name is 'name of event'
AND
State is processed
This will make specific. Thanks for adding that. 😊
Please reach me out if you need anything.
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 11:49 AM
Unfortunately, an Incident wasn't created when the event processed. Here's the screenshots of the BR. I also tried 'after' instead of 'before'.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord('incident');
gr.initialize();
gr.description = current.parm1;
gr.short_description = 'Download Activity Alert';
gr.assignment_group = ab3fe0a3dbeab5d04f917828f4961998;
gr.insert();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 11:55 AM
BR doesn't fire on [sysevent] table - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0750539
You need to use Script Actions instead.