Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
(function execute(inputs, outputs) {
var htmlString = inputs.htmlValue || '';
outputs.plainString = htmlString.replace(/<[^>]+>/g, '').trim();
})(inputs, outputs);
function removeHtmlTags(value) {
if (value === null || value === undefined) {
return '';
}

var stringValue = String(value);
var withoutTags = stringValue.replace(/<[^>]+>/g, ' ');

return withoutTags.replace(/\s+/g, ' ').trim();
}

if (typeof module !== 'undefined') {
module.exports = removeHtmlTags;
}

if (typeof inputs !== 'undefined' && typeof outputs !== 'undefined') {
(function execute(inputs, outputs) {
var htmlString = inputs.htmlValue || '';
outputs.plainString = removeHtmlTags(htmlString);
})(inputs, outputs);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've completely changed the way this IIFE is configured and it's not a pattern that most ServiceNow devs will be familiar with. For a script action in a Flow it's best to stick with the system generated template.

Loading