Output BSM Map Action Info

BSM maps (Business Service Maps) are a central feature of ServiceNow that allow users to view a visual representation of the ServiceNow CMDB and the Business Services and CIs that those services are composed of. ServiceNow BSM maps also allow you to display additional information about (and take action on) the CIs represented in the map through the use of BSM Map Actions. I was recently working to create a BSM Map Action that I wanted to display for particular types of CIs and I couldn’t see how to set up a condition that would allow me to identify the type of CI.
What I learned is that each BSM Map has certain information available through URL parameters and through a ‘Data’ object about each node on the map. I just had to find the right piece of information! The solution was to use something like the following in my ‘Condition’ field on my BSM Map Action definition.

this.getData('ci_type') == 'cmdb_ci_win_server'

This script basically says that the Map Action should not be displayed unless the CI is a Windows Server.

There are several different pieces of data that you can use to help you construct these conditions. Here is a script that I wrote to output this information in an alert message when a Map Action is clicked. The script can be placed directly in the ‘Script’ box on a Map Action record.

‘Alert Map Data’ BSM Map Action
Name: Alert Map Data
Type: Menu

//Output data about a given Map Node
var mapData = '------Map Node Data------\n';
mapData += '--Access with: this.getID()--\n'
mapData += 'ID' + ' = ' + this.getID() + '\n\n';mapData += '--Access with: this.getData("")--\n';
for(var n in this.data){
mapData += n + ' = ' + this.data[n] + '\n';

//Output data about Diagram URL Parameters
var diaData = '\n\n------Diagram Parameter Data------\n'
diaData += 'Access with: this.diagram.getParam("")\n\n';
for(var p in this.diagram.params){
diaData += p + ' = ' + this.diagram.params[p] + '\n';
alert(mapData + diaData);

Date Posted:

August 17, 2010

Share This:




Fresh Content
Direct to Your Inbox

Just add your email and hit subscribe to stay informed.