dot walking on referenced variable

jesusemelendezm
Mega Guru

Hi everyone,

I need some help with an issue I am having.

I am trying to dot walk on a reference variable using the following syntax. I want to send group approval based on the business service change control field. The change control field is a reference field on the business service table or cmdb_ci table. This field stores the group I need to map the approval.

In this case... the variable name is "business_service".

var answer =[];

answer = current.variables.business_service.change_control.toString();

Thanks in advance for your help.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Jesus,



You might try this for a more robust approach.



var answer =[];


if (current.variables.business_service.change_control)


        answer.push(current.variables.business_service.change_control.toString());


View solution in original post

4 REPLIES 4

Steven Young
Tera Guru

and you're trying to get the display value?



have you tried



var answer =[];


answer = current.variables.business_service.change_control.getDisplayValue()



or if you're just looking for the value,  



var answer =[];


answer = current.variables.business_service.change_control


Chuck Tomasi
Tera Patron

Hi Jesus,



You might try this for a more robust approach.



var answer =[];


if (current.variables.business_service.change_control)


        answer.push(current.variables.business_service.change_control.toString());


All good. It works with my initial code. I had a problem actually with the users of the group. There was another br running that prevent some users for being approver and other groups were empty. Thanks all.


marcguy
ServiceNow Employee
ServiceNow Employee

you try answer.push(current.....)?