The CreatorCon Call for Content is officially open! Get started here.

how to query cmdb_rel_ci table to get parent and child value using glide record

Abhinab Achary1
Tera Guru

Hi All,

I want to query the child value based on parent value in table cmdb_rel_ci

How can this be done

Thanks,

Abhi

1 ACCEPTED SOLUTION

Thanks. I didn't see that you changed the childList.push() line. You cannot dot-walk inside a getValue() call. IN your case, use this.



childList.push(rel.child.name);


View solution in original post

24 REPLIES 24

What are you looking to do with it on the client side? You may need to adapt the above code as a list of sys_ids typically isn't very useful to a client script.



Docs: Client Scripts


Docs: GlideForm


Docs: GlideAjax


Client Script Best Practices - ServiceNow Wiki      


i am basically trying to get those childs and pass on to the client script and fnally to separate those using for loop in client   side


Thank you. It really doesn't matter what you return. If you want to return the array of sys_ids, have your script include gather them up like the above script and then do something like this:



return childList.join(',');



The client script can then parse out the 'answer' (as in the GlideAjax sample script) and then use a standard JavaScript split() operator to turn it back from a comma separated list to an array.


Hi chuck,


I am not getting the sysid when returned


Hi Abhi,



I don't have much information to go on. Please describe the business requirement here and share the client script and script include you have so I can get a better context of what you are trying to do.



Thank you