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.

Populating one variable based on another variable on a form

Diana27
Tera Guru

Hi,

I have 2 variables in a variable set that I am using on a form.  The first variable is requested_for using the type Requested For:

find_real_file.png

I have another variable manager.

All I need to do is populate that variable (manager) with the manager of the user in Requested For.  This should be easy, however it is taking all day and I still cannot get it to work.  I'm about to go insane.

Thanks in advance for any assistance.

Diana

1 ACCEPTED SOLUTION

no... you need to create a catalog client script, not the regular client script. Instead of table, field you select variable set, variable. it should look more or less like this:

 

find_real_file.png

View solution in original post

18 REPLIES 18

Thank you for your help but I couldn't get it to work.  I'm sure it is because I am new to this. I was able to use what tomaszsienkiewicz suggested.

 

asifnoor
Kilo Patron

Is Manager a refrence field to sys_user?

If yes, then you can use a reference qualifer and in that select advanced and mention

//check the variable name

javascript:gs.getUser().getUserByID(current.variables.requested_for).getManagerID();

And under attributes, add

ref_qual_elements=requested_for

 

asifnoor,

I have attached what I now have based on your reply.  It does not seem to work. 

Here is how it looks on the form.

 

 

Ah okay.

Mention it like this.

javascript:'sys_id='+gs.getUser().getUserByID(current.variables.requested_for).getManagerID();