configuration item filter: pull back list of CI sys ids linked to service offering field

 further to my previous post regarding applying a filter to the configuration item field (e.g. on incident), following will retrieve a list of the following business service to child relationships (highlighted seems necessary so as not to pack the array with the same array multiple times!)

if (sCI_filter == 'linked to service offering' && !gs.nil(current.service_offering)) { var sSOquery='^parent.sys_class_name=service_offering^parent='+current.service_offering; var sRelType='55c95bf6c0a8010e0118ec7056ebc54d';//--Contains::Contained by var sSYSIDs= this._u_getCMDBrelCI_CIs(sSOquery, sRelType); configItemFilter +='^sys_idIN'; configItemFilter +=sSYSIDs; //gs.log(sSYSIDs,'TaskUtilsSNC:getConfigurationItemFilter'); }

_u_getCMDBrelCI_CIs: function (relationshipQuery, relType){ var sysIds=[]; var grRelCI=new GlideRecord('cmdb_rel_ci'); grRelCI.addQuery(relationshipQuery + '^type=' + relType); grRelCI.query(); while ({ sysIds.push(grRelCI.child.sys_id.toString()); } return sysIds; },


Popular posts from this blog

GlideRecord setValue

variable advanced reference qualifier example

Running transform maps asynchronously