Display values as List on a Multiple Line text variable

Insider
Giga Guru

I have a variable called approvals.

On which i show all the list of approvals who approved that current case.

as of now i am seeing data as 

approver1. approver2. approver3. approver4

But i want the data to be shown as 
approver1
approver2

approver3

approver4

 

for info i am using an array to store this data, so could it be possible to achieve this functionality with in array? should i take a new approach?

 

Please suggest

1 ACCEPTED SOLUTION

Is that a dot or a comma, I can't tell.  Try this instead:

rec.variables.first_approver = approversList.join("");

To convert the array to a string by specifying the character that comes between the members.  If it doesn't like this (no character), try taking the '\n' out of the push then join the array on "\n".

View solution in original post

8 REPLIES 8

Try this first - it will either work, or you'll see '\n' after the short description:

approversList.push(gr.approver.getDisplayValue() + ' - ' + gr.short_description) + '\n';

yeah, it didn't work.
Can you suggest how can i achieve this with some changes in my script please?

 

Hello Brad,

I was able to get the approvers as a list but i am getting a dot in the beginning even though i didn't used any dot.

Web capture_9-3-2023_22246_gskdev.service-now.com.jpeg

Is that a dot or a comma, I can't tell.  Try this instead:

rec.variables.first_approver = approversList.join("");

To convert the array to a string by specifying the character that comes between the members.  If it doesn't like this (no character), try taking the '\n' out of the push then join the array on "\n".