Catalog Item - Set the value of a variable based on a referenced location

phil34
Tera Expert

Hi All,

I have two variables in my catalog item form.

FORM

phil34_0-1683519533868.png

Field 1 is a reference field that references the location table (cmm_location) and the name of the variable is "location"

Field 2 is a Single Line Text labelled GM Approver and named "u_manager"

 

TABLE

Table cmm_location has a reference field labelled manager which references the user (sys_user) table but the name of the field is "u_manager"

 

WHAT I NEED TO DO

Each time the user selects a location in the location reference field variable on the form I want the single line text field variable on the form named "u_manager" to change or update based on the value in the "u_manager" field in the location record.

It would great if you could assist with the code and where is needs to go.

 

Lastly some advice on this in relation to the field type I am using for variable "u_manager" I am thinking it may need to be another reference field but not sure. The next step in this little project is to use the flow designer and I would want all of the fields in the cmm_location table for the selected location and all of the fields in the sys_user table based on the "u_manager" to be available in the picker.

 

Hope that makes sense

 

Phil

 

 

 

 

1 ACCEPTED SOLUTION

phil34
Tera Expert

Hello Anil, thanks for your reply but I have found some new Variable functionality that meets my use case very nicely "Auto-Populate"

phil34_0-1683539496971.png

 



View solution in original post

3 REPLIES 3

Anil Lande
Kilo Patron

Hi,

I would suggest few links and try the Client Script and GlideAjax to get this done.

https://www.servicenow.com/community/developer-forum/get-manager-name-based-an-selected-user/m-p/145...

https://www.servicenow.com/community/developer-articles/client-side-scripting-go-for-glideajax-with-...

 

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

phil34
Tera Expert

Hello Anil, thanks for your reply but I have found some new Variable functionality that meets my use case very nicely "Auto-Populate"

phil34_0-1683539496971.png

 



Thanks for sharing your findings. Forget to suggest most simple and best way 😊

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande