How to Auto populate a Catalog Variable based on other Catalog Variable's choice option.

Blitz
Tera Expert

 

Hello, A Script that can auto populate this Catalog Variable based on other Catalog Variable's choice option.

(Assume Name: position) 

Data that will be Pull is: Title in (sys_user table) 

position.png

 

 

Conditions: 

Note: (Assume name: do_you_need_to_create_new_user)

If                   

yes.png

 

 

then it will pull data from (requested_for) variable which is referencing the sys_user table

Note: This variable is in a variable set (variable set name: req_detail)

requestedfor.png

 

 

 

but the data will be pulled is the "Title" field value of the (requested_for) which is inside the sys_user table. 

The Data must be stored here (auto populate):

position.png

 

 

As for the other condition

If 

No.png

 

 

 

then pull data from (confirm_existing_acc_owner) which is referencing the sys_user table but same data will be pulled

Data: Title

confirm existing account owner.png

 

 

 

Data will populate here

position.png

 

 

This Questions includes: Script Include, Onload Client Script, OnChange Client Script

Whatever changes in the options (Yes/No) the "position" variable must also follow (auto populate with the right Data).

3 REPLIES 3

Community Alums
Not applicable

Hi @Blitz ,

Please go through the thread and make the adjustments as per your requirement :

https://www.servicenow.com/community/developer-forum/auto-populate-one-variable-on-a-catalog-item-ba...

 

Arun_S1
Tera Guru
Tera Guru

@Blitz You can manage this with the help of Catalog Data Lookup Definitions.

 

Create a catalog lookup definition

Arun_S1_0-1689829388103.png

 

 

Matcher which will query the sys_user record based on the selected requested_user

Arun_S1_1-1689829388102.png

 

 

Setter to populate the details from the retrieved sys_user record to the catalog variables

Arun_S1_2-1689829388200.png

 

 

Result:

Arun_S1_3-1689829388116.png

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.

Arun_S1
Tera Guru
Tera Guru

@Blitz You can also refer to this article about using Catalog Data Lookup Definitions

 

https://www.servicenow.com/community/developer-articles/catalog-data-lookup-definition-on-any-table-... 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.