- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 08:44 AM
Hi,
I'm working on a dynamic content block and im struggling on preserving the white space.
I want to maintain the white space between the apostrophes: news += (' ')
Any suggestions?
Script:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j2:whitespace trim="false">
<span style="color:red">
<g:evaluate>
var news = '' ;
var kb = new GlideRecord('kb_knowledge');
var now = gs.dateGenerate(gs.yesterday(), 'end');
kb.addQuery('valid_to', '>', now);
kb.addQuery('topic','News');
kb.addQuery('category', 'NewsFlash');
kb.addQuery('workflow_state','published');
kb.query();
while (kb.next()){
(news == '') ? news = kb.short_description.toString() : news += (' ') + kb.short_description.toString();
}
</g:evaluate>
<j:while test="${kb.next()}">
<j:if test="${kb.canRead()}">
<g:evaluate>
news += kb.short_description + (' ');
</g:evaluate>
</j:if>
</j:while>
<marquee behavior="scroll" direction="left"><b>${news} </b></marquee>
</span>
</j2:whitespace>
</j:jelly>
Thanks,
Adam
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 09:13 AM
I always have a good bit of trouble with jelly stripping out white spacing event when using ${SP}. What I usually do is use a div with a margin to add the space. So something like:
<marquee behavior="scroll" direction="left"><div style="font-weight:bold;margin-right:10px">${news}</div></marquee>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 08:47 AM
Hi Adam,
You can use ${AMP} to insert an ampersand in Jelly.You may want to refer below link. This will help.
Extensions to Jelly Syntax - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 09:05 AM
Hi Ketan,
Thanks for your suggestion using the ${AMP} I just get the value &.
how and where should I use the ${AMP}?
Thanks,
A

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 09:13 AM
I always have a good bit of trouble with jelly stripping out white spacing event when using ${SP}. What I usually do is use a div with a margin to add the space. So something like:
<marquee behavior="scroll" direction="left"><div style="font-weight:bold;margin-right:10px">${news}</div></marquee>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2016 09:30 AM
Hi Brad,
Many Thanks for your solution.