The CreatorCon Call for Content is officially open! Get started here.

How to convert HTML field value to String value for Description field from catalog item

SM123
Tera Expert

Hi,

URGENT : I have a business rule for to populate description field from catalog item to service request form. but the problem is the description field from catalog item is html type so when i populate it in service request form it is showing value in html form. could anyone help me how to resolve this? what script should i add on to this? 

provided the BR i used below

 

 

19 REPLIES 19

Sandeep Rajput
Tera Patron
Tera Patron

@SM123 In your business rule replace line number 8 with the following code and let me know if it works.

 

current.description = gr.cat_item.description.replace(/<\/?[^>]+(>|$)/g, "");

 

Hope this helps.

@SM123 this should work for your requirement. 

@Sandeep Rajput  Appreciate your quick response 👏

Hi, @Sandeep Rajput 

Thank you.. You almost resolved my issue but i'm facing issue with spacing for some catalog item's description. i provided the ss below. Please help me with this.. your help is much appreciated.  

@SM123 please try to trim the description and let me know, if still the same.
current.description = current.description.trim();