Auto-Populate Variable in One Variable Set from Another Variable Set

Sirri
Tera Guru

Hi All,

I have a requirement in the Service Catalog:

  • There is a global variable set named global_variable_set which contains a field requested_for (type: Reference to User). This field is editable, and the user can change it multiple times.
  • There is another variable set named business_app_update which is specific to one catalog item. In this set, there is a field is_key_person_risk_attested_by1 (type: Reference to User) that is read-only.

I need to auto-populate the read-only field (is_key_person_risk_attested_by1) with the value from requested_for whenever it changes.

Please note:

  • The global variable set is used in multiple catalog items.
  • The business_app_update variable set is specific to one catalog item.

Could you please guide me on how to achieve this? If you can share a sample script, that would be great.

Thank you in advance for your support!

1 REPLY 1

kaushal_snow
Giga Sage

@Sirri ,

 

Use a catalog client script that watches for changes to the requested_for field and then sets the value of your target variable (is_key_person_risk_attested_by1) accordingly on the form (for example using g_form.setValue('is_key_person_risk_attested_by1', g_form.getValue('requested_for')); in an onChange script........so whenever the user changes the requested_for field the risk attested field is updated to match or you can also initialize it on form load with an onLoad script as long as both variables are present on the catalog item form and have variable names, which is the typical way to copy one catalog variable value to another..............

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Technical Consultant - Rising Star/Class of Legends 2025