- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 06:51 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 12:20 PM
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);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 12:20 PM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 12:25 PM
Now my result shows this.. i think somthing wrong with split
my functions are
client
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var gaj=new GlideAjax('HelloMan');
gaj.addParam('sysparm_name','helloman');
// var ab_data=g_form.getDisplayBox('business_service').value;
var ab_data=g_form.getValue('business_service');
gaj.addParam('sysparm_business_service',ab_data);
gaj.getXML(HelloManparse);
function HelloManparse(response)
{
var answer = response.responseXML.documentElement.getAttribute("answer");
var arr = answer.split(",").toString();
for (var i=0; i < arr.length; i++)
{
g_form.addInfoMessage("\nvalue is: " + arr[i]);
}
}
}
server
var HelloMan = Class.create();
HelloMan.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloman : function(){
var parentId = this.getParameter('sysparm_business_service');
var childList = [];
var rel = new GlideRecord('cmdb_rel_ci');
// rel.addQuery('parent.name','=', parentId);
rel.addQuery('parent', parentId);
rel.query();
while (rel.next()) {
// childList.push(rel.getValue('child.name'));
childList.push(rel.child.name);
}
return childList.join(",");
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 12:31 PM
It worked thanks Chuck.. thanks a ton. I was wrongly dot walking.. its great your solution worked perfect
Thanks a ton
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 12:33 PM
but one more problem the last value seems to be empty. may b because of split
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 12:35 PM
Its working thanks.. thanks a lot. i have been struggling to make it