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.

Automatically Set the Values of One Variable Based On the Values Of Another

MikeJ89
Tera Contributor

Hello all. I'm looking to see if there's a way to automatically set the values of one variable based on the value selected for another variable within a catalog item request. For example, if a user starts filling out a catalog item request and chooses Option A for one of the questions asked, the next question will auto-populate with certain values so that the user doesn't have to pick them out from a list. Is this possible to do, and if so, what would I have to do to set it up?

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @MikeJ89 

 

Yes this is possible via Auto Populate. 

 

LearnNGrowAtul_0-1702921486504.png

 

Actually there's not much more to write on this, the Auto-populate functionality is just so straightforward! Have a Variable of type reference on your Catalog Item, create a new Variable that you want to Auto-populate and fill in the three fields under the new Auto-populate section, and that's it.

 

https://www.servicenow.com/community/developer-articles/auto-populate-reference-data-in-service-cata...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thanks @Dr Atul G- LNG and apologies for the very late reply. I've checked out the link you sent and played around with this a bit, but I can only get one value to populate based on what value was selected for another question. I'm trying to see if we can have multiple values auto-populate. For reference, the variable I need this for is a List Collector that is depending on a question that uses the Reference variable. Is that possible?

if im understanding you correctly you want to auto populate a list collector variable?  

You can autopopulate multiple fields using the OOB autopopulate method, but multiple values in a list collector i dont think is possible with the OOB method,

 

may need a script include and glide ajax

 

 

Understood, thanks. Do you have any resources that can help me get started or point me in the right direction on how I should go about writing the script?