How to break line (new line) from a string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 08:28 AM - edited 02-02-2023 09:27 AM
Hi all/ @jaheerhattiwale,
I have one string where I have stored glide record information like this 1. Jack Hawksworth 2. Kyle Toon 3. Mario Sever 4. Nikola Pintaric .
But we would like to change it as below
1. Jack Hawksworth
2. Kyle Toon
3. Mario Sever
4. Nikola Pintaric
Please find the below script which I wrote.
tech_contacts = tech_contacts + techGr.u_sequence + '. ' + techGr.getDisplayValue('u_tech_contact') + '\n';
return JSON.stringify({
"tech_contact": tech_contacts,
});
Can anyone help me on this.
Thanks,
Priya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 11:45 AM
Follow this general pattern to print data in new lines
- Create an array
- Push each new line to the array
- Use .join("\n") on array
- Store results
Example
//Create Array var description = []; //Push each new line to array description.push("Short Description: " + current.short_description); description.push("Assignment Group: " + current.assignment_group.getDisplayValue()); description.push("Category: " + current.category.getDisplayValue()); //Use join("\n") var results = description.join("\n"); //Store results current.description = results;
Result
Short Description: Issue with computer Assignment Group: Service Desk Category: PC
Thanks,
Bharath
Bharath Chintala