Remove Fields coming in Description after Record producer submission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi ,
I have 2 fields on the record producer , that are not visible on the form but visibility of the other fields are based on these field.
When user submits the case, this field comes up in the description of the case (description shows all the fields filled by user while submitting the case.)
I want to hide this field from the description but i cannot empty these field at any time.
Is there a way to hide/remove these fields from description.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
So if you are working HRSD scope, this is OOTB logic implemented there where all those variables who has some value are shown under description.
It’s not recommended to modify the OOTB script, as doing so would affect all HR services.
As an alternative, you can create a Before Business Rule specific to your HR service and, within it, use a regex-based replace function to remove the hidden variables from the description by setting them to an empty string.
(function executeRule(current, previous /*null when async*/ ) {
if (!current.description)
return;
var lines = current.description.split('\n');
var visibleLines = [];
for (var i = 0; i < lines.length; i++) {
var line = lines[i].trim();
if (line && !line.startsWith('Hidden Variable')) {
visibleLines.push(line);
}
}
current.description = visibleLines.join('\n');
})(current, previous);Assumption hidden variable names start with Hidden Variable (replace if you have a different pattern)
Description view before BR logic added:
Description view after BR logic added:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I agree with what @Community Alums mentioned.
you can use before insert BR
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
