Change is created Business Application field is selected Related CI

hazelfortuno
Tera Expert

Hi Everyone,

 

Whenever I created a change and the Business application is selected all the related CI's should be listing in the Impacted CI's tab. What should I do in this case? 

 

Thank you

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

HI @hazelfortuno ,
I trust you are doing great.

Create a new Business Rule:

  • Navigate to "Business Rules" in ServiceNow.

  • Click on "New" to create a new Business Rule.

  • Provide a name for the Business Rule, such as "PopulateImpactedCIs".

  • In the "When to run" section, select the appropriate condition, such as "before" or "after" update.

  • In the "Advanced" section, add a script to query and populate the Impacted CI's tab based on the selected Business application.

  • Here's an example script you can use as a starting point:

(function executeRule(current, previous) {
    if (current.business_application) {
        var relatedCIs = [];
        var ciGr = new GlideRecord('cmdb_rel_ci');
        ciGr.addQuery('type', 'Depends on::Used by');
        ciGr.addQuery('parent', current.business_application);
        ciGr.query();
        
        while (ciGr.next()) {
            relatedCIs.push(ciGr.child);
        }
        
        current.impacted_cis = relatedCIs.join(',');
    }
})(current, previous);
  1. Configure the Business Rule:

    • Specify the appropriate table(s) and condition(s) for the Business Rule to run on.
    • For example, you can select the "Change Request [change_request]" table and set the condition to execute the rule when a record is created or updated.
  2. Save and activate the Business Rule.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



@Amit Gujarathi  Thank you for your response. I'll try to use it. Will let you know if it's working.

Thank you,

Hazel