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.

how to concatenate all variables

VRNR
Kilo Contributor

Hi All,

I have created a Record producer with 4 variables(Multi line text).It will create a story(rm_story). Now i want to concatenate all 4 variables in description field.How to achive that?

Note: All variables are multi line text.

Regards,

Ram

2 REPLIES 2

Deepak Ingale1
Mega Sage

Hi Ram



You can try below with before insert business rule


var appendedInfo = '';


for ( var v in current.variables ) {


appendedInfo = appendedInfo   +   v   +   ": " + current.variables[v]   + "\n";


}



current.description = appendInfo;


Rajesh Mushke
Mega Sage

Hey Ram,



Here is an Example for your Query:



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



var fName=g_form.getValue(first_name);


var LName=g_form.getValue(last_name);


var ofcLoc=g_form.getValue(office_location);



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


comm=String(comm);



g_form.setValue('comments',comm);



Hope this will helps you and let me know if you need more help.




Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke