Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Bulletted formatting under Description for Catalog Items

Winnie P
Mega Sage

Hello There - Is there a reason why bulletted formatting does not line up ie, under Description when creating a Catalog Item. Is it possible to line up bullet points? Thank you.

find_real_file.png

1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

In the backend I see it aligns different:

find_real_file.png

Based on this Stackoverflow post:

https://stackoverflow.com/questions/11556493/second-line-in-li-starts-under-the-bullet-after-css-res...

 

you can do the following:

find_real_file.png

 

Then add styling:

find_real_file.png

(change <ul> to <ul style="list-style-position: outside; margin-left: 1em;">)

 

The result:

find_real_file.png

View solution in original post

12 REPLIES 12

Thank you Willem.  Here's more information & screenshots.  This is from the Catalog Item:

find_real_file.png

 

This is from the Service Portal;

find_real_file.png

Willem
Giga Sage
Giga Sage

In the backend I see it aligns different:

find_real_file.png

Based on this Stackoverflow post:

https://stackoverflow.com/questions/11556493/second-line-in-li-starts-under-the-bullet-after-css-res...

 

you can do the following:

find_real_file.png

 

Then add styling:

find_real_file.png

(change <ul> to <ul style="list-style-position: outside; margin-left: 1em;">)

 

The result:

find_real_file.png

Thank you Willem, this worked. Do you need to make this change each time you create a new Catalog Item that contains bullet points that includes long sentences? What would be your solution if we had more than 100 Catalog Items with the same scenario? Is there a way to do a multiple fix? 🙂 I tested in my personal instance as follows and looks good:

find_real_file.png

However, when I selected the bullet point list again - it reverted back:

find_real_file.png

You could use an onChange client script to always convert the <ul>  to <ul style="list-style-position: outside; margin-left: 1em;"> when the Catalog item is created/updated.

Or you have to adjust the CSS in multiple places.

 

The client script:

you can create it on Catalog item table and check the inherited box:

find_real_file.png

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}

	if(newValue.indexOf('<ul>')!=-1){
		g_form.setValue('description', newValue.replace('<ul>', '<ul style="list-style-position: outside; margin-left: 1em;">'));
	}
	if(newValue.indexOf('<ul style="list-style-position: inside;">')!=-1){
		g_form.setValue('description', newValue.replace('<ul style="list-style-position: inside;">', '<ul style="list-style-position: outside; margin-left: 1em;">'));
	}

}

 

 

To fix existing records you can use a background script or fix script. Something like this:

var grItem = new GlideRecord('sc_cat_item');
grItem.addEncodedQuery('descriptionLIKE<ul>^ORdescriptionLIKE<ul style="list-style-position: inside;">');
grItem.query();
while (grItem.next()) {
    grItem.description = grItem.description.replace('<ul>', '<ul style="list-style-position: outside; margin-left: 1em;">');
    grItem.description = grItem.description.replace('<ul style="list-style-position: inside;">', '<ul style="list-style-position: outside; margin-left: 1em;">');
    grItem.update();   
}