- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2024 02:54 AM
Hello Team,
I am trying to display a list of accessories, ordered via a Record Producer, in an email notification. My goal is to present the list in a bulleted format. To achieve this, I have written an email script; however, the output appears in a single line instead of separate bullet points.
Below, I have included the snippet of my email script along with the email notification preview for reference.
Could you please guide me on how to achieve the desired bulleted format? Any assistance would be greatly appreciated.
Thank you in advance for your help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2024 05:45 AM
you should use this
template.print('<ul>');
for(var i=0; i< numSel; i++){
template.print('<li>' + result[i] + '</li>');
}
template.print('</ul>');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2024 05:57 AM
Hi @Shailja Dosar ,
You adjust your code like below.
if (numSel.length() > 0) {
var output = '<ul>';
for (var i = 0; i < numSel; i++) {
output += '<li>' + result[i] + '</li>';
}
output += '</ul>';
// Output the list
template.print(output);
} else {
template.print('No accessories ordered.');
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2024 05:45 AM
you should use this
template.print('<ul>');
for(var i=0; i< numSel; i++){
template.print('<li>' + result[i] + '</li>');
}
template.print('</ul>');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2024 05:57 AM
Hi @Shailja Dosar ,
You adjust your code like below.
if (numSel.length() > 0) {
var output = '<ul>';
for (var i = 0; i < numSel; i++) {
output += '<li>' + result[i] + '</li>';
}
output += '</ul>';
// Output the list
template.print(output);
} else {
template.print('No accessories ordered.');
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2024 01:38 AM
Hi @Shailja Dosar ,
Thank you for marking my solution as helpful! The community now supports multi-solution acceptance, allowing you to accept multiple answers.