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.

Escape character HTML code in bussiness rule

davidgustafsson
Tera Expert

I am trying to remove white space from signature in emails. In this I found that the HTML field that I use are automatically  adding an extra line of HTML code:

<p >&nbsp;</p >

What I try to do is to add a business rule to remove this line as the user record with this HTML field is saved. But I can´t even find out how to add the escape characters correctly to point at that line. 

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

Are you fetching the HTML Value or String Value?

You can try this once

var text = current.u_text.getHTMLValue();
text = text.replace("<p >&nbsp;</p >","");
current.u_text = text;

 

View solution in original post

2 REPLIES 2

SaiRaviKiran Ak
Tera Guru

You can use   .replace("<p >&nbsp;</p >", "");

Alikutty A
Tera Sage

Are you fetching the HTML Value or String Value?

You can try this once

var text = current.u_text.getHTMLValue();
text = text.replace("<p >&nbsp;</p >","");
current.u_text = text;