Binding alerts to Custom CI type without using event rules

Dheeraj Pology
Tera Contributor

I have custom CI Class 'interface' extended from cmdb_ci into new table x_abc_interface. I have events coming in with Node values same as Interface name. How can i bind the alerts to interface CIs without using event rules?

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Dheeraj Pology ,
I trust you are doing great.

Here's a step-by-step approach:

  1. Create a new Business Rule: Go to the "Business Rules" module in ServiceNow, and click on "New" to create a new Business Rule.

  2. Set the conditions: Define the conditions under which the Business Rule should trigger. In this case, you'll want to set the condition to check for the specific events that are coming in with Node values matching the Interface name.

    Here's an example of the condition you can use in the Business Rule:

 

current.name == current.node

 

  • This assumes that the event's name field corresponds to the Interface name and the node field holds the Node value.

  • Define the actions: Within the Business Rule, specify the actions that should be executed when the conditions are met. In this case, you'll need to find the corresponding interface CI and bind the alert to it.

    Here's an example of the code you can use in the Business Rule to accomplish this:

 

var interface = new GlideRecord('x_abc_interface');
if (interface.get('name', current.node)) {
  current.cmdb_ci = interface.sys_id;
}

 

  • This code retrieves the x_abc_interface record where the name matches the node value from the event. If a matching record is found, it sets the cmdb_ci field of the alert record (current) to the sys_id of the interface CI.

  • Save and test: Save the Business Rule and test it by creating or updating an event that matches the conditions. Verify that the alert is now correctly bound to the corresponding interface CI.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Dheeraj Pology
Tera Contributor

Hi Amit,

Thank you for your solution. I do have this idea of using business rule but it is not always a best practice as it may impact EM performance. I was expecting something that we can do related to CMDB.

 

Thanks & Regards