Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Dynamic Reference Qualifier

Rooma1
Tera Contributor

Hi All,

I am trying to build a dynamic reference qualifier on incident form for the field called 'Service' which is a reference field of cmdb_ci_service. For some reason it is not giving me correct results.

Below are the screenshots:

Rooma1_0-1708254382805.png

 

Rooma1_0-1708255203619.png

 

 

Rooma1_3-1708254489862.png

Can any one let me know where I am making mistake?

 

Thanks,

Rooma

 

4 REPLIES 4

kamlesh kjmar
Mega Sage

Hi Rooma,

 

In you script include where you have written return statement, replace 'return services' with below line:

return "sys_idIN"+services.join()

 

Please Mark my response correct if this solves your issue and hit Helpful button if this helps.

 

Thanks,

Kamlesh

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @Rooma1 ,

 

You script is incorrect that's why it's not working.

Replace Line no 10  & 13 with:- 

 

//line 11
services.push(ga.getValue('sys_id')); or services.push(ga.sys_id.toString());
//line 13
"sys_idIN"+services.join(',');

 

Thanks,

Alka Chaudhary

@Alka_Chaudhary I have changed the code as per your instruction but still not working.

Rooma1_0-1708258121319.png

 

@Rooma1 ,

Please try the below code and replace the sys id of ACME Africa company in line 2.

var ga = new GlideRecord('cmdb_ci_service');
ga.addQuery('company','86c1f3193790200044e0bfc8bcbe5d95');// ACME Africa company sys id
ga.query();
var services = [];
while(ga.next()){
services.push(ga.sys_id.toString());
}
return "sys_idIN"+services;

 Thanks,

Alka Chaudhary