Catalog Item: Join Values from Two Variables

TStark
Kilo Sage

Is it possible to join the values of two variables and populate a third variable with the results of the join from those two values? For example, let's say I have the following:

 

Variable 1: Multi Line Text (i.e. example text 1)
Variable 2: Multi Line Text (i.e. example text 2)

Variable 3 (hidden and mapped to a text field on a table): The values of #1 + #2 (i.e. example text 1 example text2)

Thanks!

1 ACCEPTED SOLUTION

Hemanth M1
Giga Sage
Giga Sage

Hi @TStark ,

 

Why don't you concatenate and update variable 3?

During onSubmit (you can do it onChange as well) - OnSubmit catalog client script.

 

And aslo what type of field are you maaping on the table, is it string??

var v3= g_form.getValue('variable1').toString().trim()+ g_form.getValue("variable2").toString().trim()
g_form.setValue("variable3", v3);

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

2 REPLIES 2

Hemanth M1
Giga Sage
Giga Sage

Hi @TStark ,

 

Why don't you concatenate and update variable 3?

During onSubmit (you can do it onChange as well) - OnSubmit catalog client script.

 

And aslo what type of field are you maaping on the table, is it string??

var v3= g_form.getValue('variable1').toString().trim()+ g_form.getValue("variable2").toString().trim()
g_form.setValue("variable3", v3);

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Ehab Pilloor
Mega Sage

Hi @TStark,

It is possible to do in the Record Producer. You can use onSubmit Client Script for this usecase.

var var3 = g_form.getValue('variable1').toString()+ " - " + g_form.getValue("variable2").toString() 
// .toString() to be used incase your variables are not of type string.
g_form.setValue("variable3", var3);

Use UI Policy to hide the 3rd Variable rather than adding it to the Client Script.

 

If you found my reply useful, please mark it as Solution and Helpful. This will help me and the community.

 

Thanks and Regards,

Ehab