- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2018 03:50 AM
how-to-concatenate-text-from-multiple-rows-into-a-single-text-string in service now using jelly or glide record For Example i have a name field in my table having 2 records one is shilpi and second in arti i want to display output as "shilpi,Arti". Please help urgently as i am novice developer and give proper example
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 06:52 PM
Your easiest bet would be to use GlideRecord
and then use a simple array
and join
, like so:
// Define our array to push onto
var concatString = [];
// Initialise GlideRecord and get the results
var gr = new GlideRecord('table');
gr.query();
// Step through the results
while(gr.next()) {
// Push the string value of our name onto the array stack
concatString.push(gr.name.toString());
}
// Join the array values together with a comma
concatString.join();
That will step through all records returned, push the string value of name
onto the array, and then join them with a comma.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 06:52 PM
Your easiest bet would be to use GlideRecord
and then use a simple array
and join
, like so:
// Define our array to push onto
var concatString = [];
// Initialise GlideRecord and get the results
var gr = new GlideRecord('table');
gr.query();
// Step through the results
while(gr.next()) {
// Push the string value of our name onto the array stack
concatString.push(gr.name.toString());
}
// Join the array values together with a comma
concatString.join();
That will step through all records returned, push the string value of name
onto the array, and then join them with a comma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 09:58 PM
Thanks benjamin.alldridge your answer really help me lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 09:42 PM
Hi Shilpi,
You can use below sample and make changes to your code in Jelly like this
<td>LOCKER</td> //Suppose field name is LOCKER
<td>${jvar_gr.getDisplayValue('u_a')} // field LOCKER is made up of field "a" and field "b"
${jvar_gr.getDisplayValue('u_b')}
</td>
THEN you can get values of both fields and put like above
And in case of GLIDE record
var gr = new GlideRecord('sample_table');
gr.addQuery('active', true);
gr.query();
while(gr.next())
{
gr.u_LOCKER = gr.u_a + '' +gr.u_b;
}
The above glide record queries "sample table" , pulls up all active records and concate the values of "a" and "b" and assign it to LOCKER field for all those records that had active as true