Comments on: Walking the ServiceNow CMDB Relationship Tree https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:51:39 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Josh https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6461 Fri, 27 Oct 2017 16:14:10 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6461 I feel like I’m getting closer, but no cigar. Not sure what the ‘function’ should be?
I have it calling the script include.

function addAffectedCis() {
var ciu = new CIUtils2();
var affectedcis = ciu.cisAffectedByTask(current.cmdb_ci, ‘ALL’);
var m2m = new GlideRecord(‘task_ci’);
for (var i = 0; i < affectedcis.length; i++) {
m2m.initialize();
m2m.task = current.sys_id;
m2m.ci_item = affectedcis[i];
m2m.insert();
}
}

]]>
By: Josh https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6460 Fri, 27 Oct 2017 14:38:26 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6460 Hello Mark – I’m more on the process side of things now, but this is exactly what I’m looking for and would really appreciate a bit more information.

So I get the Script Include part; what I’m not so good at is the scripting for calling the script include.

The ‘get impacted services’ UI action is what I’m trying to base a custom one on…but I don’t know what the script should look like or what a couple of lines of code the impacted services one are for.

I created a CIUtils2 script include, essentially copied and pasted the script you have above – but not sure what to put into UI action to actually call it.

I want to primarily pull all upstream affected CIs and apply them to the Change record.

What exactly do I change in this script to do that? Not sure what function should be or the m2m.cmdb_ci_services line should be to call ‘all’ upstream regardless of class. Help? Thanks!

function addAffectedServices() {
var ciu = new CIUtils2();
var services = ciu.cisAffectedByTask(current.cmdb_ci, [“ALL”]);
var m2m = new GlideRecord(‘task_cmdb_ci’);
for (var i = 0; i < services.length; i++) {
m2m.initialize();
m2m.task = current.sys_id;
m2m.cmdb_ci_service = services[i];
m2m.manually_added = 'false';
m2m.insert();
}

]]>
By: Raj https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6458 Thu, 29 Jun 2017 01:21:50 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6458 In reply to Erite.

Hi Erite,

We have a similar requirement. Could you please share the CIUtils3 which you have developed.

Thanks in advance.

]]>
By: Andrés Ramirez https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6457 Thu, 23 Mar 2017 20:06:51 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6457 Many Thanks, Mark.
I have learn so much with your code ;-)

]]>
By: Mark Stanger https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6456 Wed, 26 Oct 2016 20:58:21 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6456 In reply to Steve Klopfer.

It’s telling you that ‘TaskGlideRecord’ isn’t defined. You need to set that variable somewhere up above (or pass in ‘current’ to the function instead).

]]>
By: Steve Klopfer https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6455 Wed, 26 Oct 2016 17:56:58 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6455 I tried to utilize the CIUtils2 script on Helsinki, and am getting this error when calling it from a UI Action on a change:

org.mozilla.javascript.EcmaError: “TaskGlideRecord” is not defined.
Caused by error in at line 2

1: var ciu = new CIUtils2();
==> 2: var services = ciu.cisAffectedByTask(TaskGlideRecord, [ALL]);

I had to remove the “” from ALL as the syntax checker didn’t like them. Any ideas what is being don wrong?

]]>
By: Mark Stanger https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6454 Fri, 01 Jul 2016 15:00:52 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6454 Whatever way you put them in or like to call them, the relationship should always accurately reflect the impact flow. That’s the whole point of the relationship diagram in this case.

]]>
By: Joseph Capobianco https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6453 Fri, 01 Jul 2016 14:18:52 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6453 In reply to Mark Stanger.

Intriguing. So, when establishing a relationship using a CI that potentially has an impact upstream, you should never use a “sideways” relationship (i.e. reverse the direction of dependencies). They should always be “vertical,” correct?

]]>
By: Mark Stanger https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6452 Thu, 30 Jun 2016 18:54:13 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6452 In reply to Joseph Capobianco.

Forget about the descriptors, several of those provided out-of-box aren’t correct and they’re just labels anyway. I was just putting those in there as an example and wasn’t intending to prescribe any particular relationship type. The point is that your parent-child relationships need to flow down from the Business Services/Applications. They should be the parent of everything else and your Racks, etc. would generally be at the bottom-most level. You want the impact to flow up to the parent in every case.

As far as your storage volumes/arrays, you need to look at the impact relationship there as well. What is impacted if your storage array goes down? The thing that is impacted should be a parent to the storage array. In that case you’ll probably have many parents.

]]>
By: Joseph Capobianco https://servicenowguru.com/cmdb/walking-servicenowcom-cmdb-relationship-tree/#comment-6451 Thu, 30 Jun 2016 18:27:02 +0000 https://servicenowguru.wpengine.com/?p=521#comment-6451 In reply to Mark Stanger.

But “contained by” is a child descriptor, right? So what you wrote is actually what we have

Also, how would you correctly relate storage volumes/arrays or databases in a proper BSM map?

]]>