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.

How to retrieve value from an HTML Type Field

Para5
Tera Guru

Hi All,
Is anyone knows how to retrieve value from an HTML Type Field. I have a field on form 'long_description'  And I want to print only the text  from it.

I tried this one   current.getValue('long_description');   but it print all the tag.

Thank you.

 

2 ACCEPTED SOLUTIONS

Updated script. added space between ""(double quote).

var regex =  /( |<([^>]+)>)/ig;
var content =current.getValue("long_description").replace(regex, " ");  

View solution in original post

@Para5 ,

 

Try the below code:

var regex =  /( |<([^>]+)>)/ig;
var content =current.getValue("long_description").replace(regex, " ");

I hope this help.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

View solution in original post

7 REPLIES 7

Hi @kamlesh kjmar 
Thank for response. 

I have added above code. Now this prints only content but the Space is not present between the words.

e.g HiUser    but I want link this   Hi User

Updated script. added space between ""(double quote).

var regex =  /( |<([^>]+)>)/ig;
var content =current.getValue("long_description").replace(regex, " ");  

@Para5 ,

 

Try the below code:

var regex =  /( |<([^>]+)>)/ig;
var content =current.getValue("long_description").replace(regex, " ");

I hope this help.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh