- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 01:30 PM
I have a description field on demand task form. Users can input a description from the Create a Demand catalog item.
The issue I'm seeing is that the data they provide is coming in within <p></p> HTML on either end (see screenshot)
Is there a simple solution to remove these tags?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 02:52 PM - edited 02-23-2024 02:53 PM
Hi @MBarrott ,
Could you please refer the below article ,
write after insert BR with reference of below article
https://www.servicenow.com/community/developer-forum/script-catalog-items-description-to-request-wit...
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 02:52 PM - edited 02-23-2024 02:53 PM
Hi @MBarrott ,
Could you please refer the below article ,
write after insert BR with reference of below article
https://www.servicenow.com/community/developer-forum/script-catalog-items-description-to-request-wit...
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 07:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 03:14 PM
Hi @MBarrott ,
Are you using record producer for demand creation then you can use the below code line in script section, this will remove any HTML tag from incoming description data.
current.description = producer.description.replace(/<[^>]*>/g, ' ');
You can test this code in background script
var description = '<p>test description</p>';
description = description.replace(/<[^>]*>/g, ' ');
gs.info("Description->"+description);
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 08:12 AM
Thank you very much . I didnt know you could append
.replace(/<[^>]*>/g, ' ');
to a variable to strip the formatting like that. That will be very useful 🙂
Andy