TUESDAY, FEBRUARY 07, 2012

Output BSM Map Action Info

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 Action
Name: 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("<Node Name>")--\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("<Parameter Name>")\n\n';
for(var p in this.diagram.params){
   diaData += p + ' = ' + this.diagram.params[p] + '\n';
}
alert(mapData + diaData);

Leave a Reply


Notify me of followup comments via e-mail. You can also subscribe without commenting.

Latest Comments

  • Mark Stanger: This linkage all happens for you if you use the task survey plugin. You can look on the wiki for more...
  • Vineeth: I want a way in which if a survey is filled in by the user the response are stored in the survey response...
  • Mark Stanger: This functionality doesn’t connect to an FTP server. See this line in the post above…...
  • Mark Stanger: The report page is back-end XML so there’s no way to directly manipulate the behavior of that...