Have you ever created a manual service through the event management module to get service tiles to appear on the Event Management dashboard (i.e. you’re not using our Service Mapping capabilities yet)?


If so, you’ve probably noticed that any changes in related CI’s (new relationships) do not appear on the map automatically. The changes will appear in the Related Items section of the service definition, but only appear on the map when you once again click the “Populate” button that you had to originally click when defining the manual service and creating the original map.


Example of a manual business service update

Let’s look at an example. In the manual service below, I chose the SAP WEB01 configuration item (CI) as the pseudo entry point of this service and then all related items for that CI were brought in to the Related Items section of the form.  Here you see 2 app servers (SAP AppSRV01, and SAP AppSRV02) related to the primary CI (SAP WEB01).


related items.jpg

Manual Service Related CI’s


The map also reflects this relationship once you click the “Populate” button to populate the manual service form with all the CI’s shown in the related items section.

populate CI.jpg

Manual Service Map


Now let’s add a CI that mirrors the definition of the two app servers, and so that it has a child relationship to the SAP WEB01 CI.  Once that’s done, the Related Items on the manual service form will be automatically updated.  However, the list of Configuration Items at the bottom of the form does not automatically populate.  It’s waiting for you to click the populate button.

configuration item.jpg

Updated Related CI's List for Manual Service


At any scale this is just not desirable and, like me, you probably would like for these maps to have any changes in CI relationships automatically reflected on the map without having to open the manual service form, again, and click the Populate button, again.


Solution: Automatically map changes in CI Relationships

Let’s see how this could be done. First, you can search for the “Populate” UI Action in System UI > UI Actions.  When you open the Populate UI Action you see the following code.


populate ui action.jpg

UI Action for Populate Button


Well this doesn’t appear to give us what we need to write a script to automate the process.  However, it does give us another direction to look in that this code is creating the pop-up window asking you how many levels you want to populate on the map.  Maybe that pop-up window will have what we need.  Let’s take a look at the UI Page for “manual_service_choose_levels_to_populate” (System UI > UI Pages).


In the Processing Script section of the form for this UI Page we see the following code.

Processing script.jpg


Script Controlling the Update of Manual Service Map




We can reuse most of this code to create a scheduled job to execute a script for our manual service and have it run on the schedule of our desire.  Here is the code I put into a scheduled job, but the logging options and notations are totally up to you.  You will need to obtain the sys_id of the manual business service, and if you’re not sure how, one easy way is to just open the form for the manual service and right-click the header and select “Show XML”.  From there you can search for sys_id and copy it into the script.


manual services.jpg

Obtain sys_id from “Show XML” menu option


In my implementation of the script on a scheduled job, which can be done by performing:

  1. System Definition > Scheduled Jobs
  2. Select New
  3. Select Automatically run a script of your choosing


I am specifying to import up to 6 levels onto the map.  This can be a range from 1 to 8 so choose based on your own need.  It’s all about map clutter when viewing the map, so assess the visual impact of more levels versus less.


scheduled job.jpg

Scheduled Job Form to Execute a Script


When the scripts execute at 10 minutes after midnight, my map will be updated with any changes from the previous 24 hours.

SAP web.jpg

Updated Manual Service Map based on Scheduled Job


Here’s the code in an easier cut and paste format:


// This script will effectively execute the "Populate" UI action for

// a manual service in the event management module. This will update

// the manual service map with any new CI's related to components

// already defined as part of the service

gs.log("Populating manual service XYZ", "Custom: repopulate manual svc");

var im = new SNC.ImpactManager();

im.populateCIsToManualService('[INSERT YOUR SVC SYS_ID HERE]', 6);

gs.log(6 + " layers of related items were imported into the XYZ business service.", "Custom: repopulate manual svc");


In conclusion, we are able to keep manually created business service maps up to date using a scheduled job versus having to manually click buttons within the UI.  This helps avoid unnecessary delays in troubleshooting time by ensuring all related CI’s are reflected as part of the business service and have events processed against them be part of the overall event management dashboard.  As a point of clarification, any CI that is deleted or has its relationship removed from related CI’s in the defined service will automatically be reflected in the manual service map and does not require this process to run to make the update.