Is it possible to use dot walking in a Query Business Rule?

abrahams
Kilo Sage

I am struggling to get dot walking in a query business rule.

 

For a given role, I'm trying to show only HR tasks when the parent.hr_service cases is a desired Service.

 

This is a little example of the syntax I tried but it doesn't appear to work in a query business rule.  <sys_id> in my query is actually the sys_id of the HR Service.

 

var qry = current.addQuery('parent.hr_service', '<sys_id>');
 
Does anyone have any ideas how I could get this to work?
1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Dot-walking doesn't seem to work, at least in this case.  Here's a workaround for the Query Business Rule script:

function executeRule(current, previous /*null when async*/) {
	var resultsArr = [];
	var parGr = new GlideRecord('sn_hr_core_task');
	parGr.query();
	while (parGr.next()) {
		if (parGr.parent.hr_service == '9e28cde49f331200d9011977677fcf00') {
			resultsArr.push(parGr.sys_id.toString());
		}
	}
	current.addQuery('sys_id', 'IN', resultsArr.join(','));  
})(current, previous);

 

View solution in original post

5 REPLIES 5

The dot walking didn't work in hr application.  I tried that but maybe it is only HR, that didn't work.