Script not returning the parent value of cmdb_rel_ci record

gjz
Mega Sage

We have a catalog item that is a request to update a CI.  One of the requirements for the catalog item is to display the current values of the CI and it's relationships for two specific classes of CIs (servers and applications only).  Displaying the CI's current values is working, but displaying the relationships is not.

 

Using a specific CI that I know has a relationship with an application and a server, I created a really simple script to see if I can find why - and it's because the parent field doesn't return a value and I don't understand why.

 

gjz_1-1701905793509.png

 

 

In the above screen shot, you can see the parent CI doesn't return any value, but I know there is one, I checked the xml for the record; it exists. 

gjz_2-1701905911056.png

Does anyone know why I can't access the parent value from cmdb_rel_ci?

 

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @gjz 

In your script, the line number 6 you're using comma instead of plus.

Let's try my adjustments below

 

gs.print('parent ci: ' + a.parent);

 

Or

 

gs.debug("parent ci: {0}", a.parent);

 

 

Cheers,

Tai Vu

View solution in original post

7 REPLIES 7

SanjivMeher
Kilo Patron
Kilo Patron

It should work. Can you also try a.getValue('parent')


Please mark this response as correct or helpful if it assisted you with your question.

AshishKM
Kilo Patron
Kilo Patron

Hi @gjz ,

Your code is perfectly fine and it should print the parent CI's sys_id the only possible caused i can think about the read access on that CI table to you or other users who are using the catalog item.

 

Check the read ACL on that parent class, being an admin if it's not visible to you it means some other restriction in place.  Also check if this same parent is visible to you in list view from cmbd_rel_ci table.

 

-Thanks


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Tai Vu
Kilo Patron
Kilo Patron

Hi @gjz 

In your script, the line number 6 you're using comma instead of plus.

Let's try my adjustments below

 

gs.print('parent ci: ' + a.parent);

 

Or

 

gs.debug("parent ci: {0}", a.parent);

 

 

Cheers,

Tai Vu

omg , good catch. 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution