Calling script include in reference qualifier

Anna_Servicenow
Tera Guru

I have the below requirement:

I have  form field - child server

In the child field should show all servers that has only 1 parent(or 1 row count),

I have below script in place, but this retrieves all child servers that has more than i parent

 

var serverrel = new GlideRecord('cmdb_rel_ci');

        serverrel.addEncodedQuery('child.operational_status=1^child.ref_cmdb_ci_win_server.support_group=3217a87eeb054319562073cbb3546^child.sys_class_name=cmdb_ci_win_server^parent.name=' + current.variables.patch_application_service.getDisplayValue() + '^child.location.u_region=' + current.variables.patch_select_region);

 

        serverrel.query();

        var EquipementIDs = '';

        while (serverrel.next()) {

            EquipementIDs += ',' + serverrel.child;

 

        }

        return 'sys_idIN' + EquipementIDs;

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Anna_Servicenow 

So you are saying you want to fetch only those childs which are having more than 1 parent?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar No, Which have only 1 parent.. this script is giving list of child server that has single and more parent