Need Clean HTML-Free Comment Display in Activity History from Scoped App Without Using journal_field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 06:00 PM
Hi all,
I'm working within the Third-Party Risk Management (sn_vdr_risk_asmt) application and trying to solve a common issue related to how HTML fields behave in the activity formatter.
Goal:
When users update any of our 11 custom fields (all of type HTML), we want to:
Log a clean version (stripped of all HTML tags)
Clearly label which field the comment came from (e.g., [ABC Comments])
Show this cleaned text in the activity history, so it's easily readable
Do this entirely within scope (no global writes or elevated access)
What I've Tried:Created a Journal Input field (u_comment_log)
Used a Before and After Business Rule to call setJournalEntry('u_comment_log', cleanText)
Also tried populating a String field (u_clean_comment_logInstead and added it to the activity formatter
Implemented logic to strip HTML using:
"var clean = htmlString.replace(/<\/?[^>]+(>|$)/g, ""); and also
"GlideStringUtil.stripHTML();Enabled audit tracking, made sure no_audit = false, set field as multi-line
Tried all combinations of:
Journal Input vs String
setJournalEntry() vs current.field = value
Before and After Business Rules
Current Roadblock:
Everything works technically — the field is populated correctly — but the cleaned comment does NOT appear in the activity stream unless the user manually toggles the funnel icon (activity filter) to uncheck/recheck the field.
I’m trying to avoid:
Writing directly to sys_journal_field (due to cross-scope restrictions and potential platform impact)
Changing global properties
Asking users to manually click funnel checkboxes to “wake up” the activity formatter
- Manual cross-scope access to sys_journal_field (denied due to platform restrictions)
Has anyone achieved this before?
Specifically:
Has anyone successfully forced a Journal Input or String field — populated in a scoped BR — to display in the activity stream without using sys_journal_field?
Is there a supported or best practice workaround for logging clean comment activity from HTML fields, within scope, that shows in the activity formatted?
Are there any platform-level limitations in scoped apps around this behavior?
Any guidance, tricks, or recommended alternatives would be deeply appreciated!
Thanks in advance 🙏
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:12 PM
I want to know why you do not copy value of the custom fields to comments field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:32 PM
@Di Zhang Great point — I initially avoided that because I was trying to maintain clean separation between comments and audit logs. But after testing, copying cleaned versions of HTML comments into the comments field using setJournalEntry() did not work.
(function executeRule(current, previous) {
var fields = {
'u_bc_comments': 'BC Comments',
'u_compliance_comments': 'Compliance Comments',
// ... all 11 fields
};
for (var field in fields) {
if (current[field] != previous[field]) {
var raw = current[field] || '';
var clean = raw.replace(/<\/?[^>]+(>|$)/g, '').trim();
if (clean) {
current.setJournalEntry('comments', '[' + fields[field] + '] ' + clean);
}
}
}
})(current, previous);
Something like this but no use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:53 PM
or try current.comments.setJournalEntry('[' + fields[field] + '] ' + clean);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:48 PM
try current.comments = '[' + fields[field] + '] ' + clean