How to concat multiple value in one variable

florence2
Tera Contributor

HI,

in catalog item, I have to show on 1 variable named  the concatenation of 3 information from the same record (core_company_list)

-plant

-company code

-Name

 

florence2_1-1707922046257.png

below what should be appeared in the variable.

florence2_0-1707921849284.png

How Should I do?

thanks for your support.

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @florence2 

 

https://www.servicenow.com/community/developer-forum/how-to-concatenate-two-variable-field-values-in...

 

https://jesusemelendezm.medium.com/concatenating-string-fields-in-servicenow-c5add52db32f

*************************************************************************************************************
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]

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

Sumanth16
Kilo Patron

Hi @florence2 ,

Just write an onChange client script, with the condition that none of these fields are empty.


var fName=g_form.getValue(first_name);//update your field name

var LName=g_form.getValue(last_name);//update your field name

var ofcLoc=g_form.getValue(office_location);//update your field name

var comm = fName + "" + LName+ "" + ofcLoc;

comm=String(comm);

g_form.setValue('comments',comm);//update your field name

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,
Sumanth Meda

 

Maddysunil
Kilo Sage

@florence2 

var plant=g_form.getValue('u_plant');

 

var comp=g_form.getValue('u_companycode');

 

var name=g_form.getValue('name');



var result =plant + "" + comp+ "" + name;

 

Kindly mark helpful/accepted if it helps you.