Output BSM Map Action Info
Tuesday, 17 August, 2010 09:43 Written by Mark Stanger
0 Comments
BSM
maps (Business Service Maps) are a central feature of Service-now.com that allow users to view a visual representation of the Service-now CMDB and the Business Services and CIs that those services are composed of. Service-now 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 ActionName: Alert Map Data Type: Menu
Script:
//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);
This entry was posted on Tuesday, August 17th, 2010 at 9:43 am and is filed under System Definition. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
https://web.archive.org/web/20130702024306/http://www.servicenowguru.com/system-definition/output-bsm-map-action-info/

