Hide checkbox values when false currently being displayed in description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2025 02:56 PM
In a catalog item, based on certain selection of variable, we are displaying follow up questions having variable type "Checkbox". When these checkboxes are checked(value True), it is being displayed in the description of the RITMs, completely fine But I dont want these checkboxes question to be displayed in Description when their value is False.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2025 03:52 PM
Hi @PriyankaM750292 ,
Try to use Script include and Business rule.
Script Include fetches only checked checkboxes from the item_option_new table.
Business Rule ((Run: Before Insert/Update) on sc_req_item table) which updates the description before. inserting/updating the RITM.
Sample code :
Script Include :
var RITMDescriptionFilter = Class.create();
RITMDescriptionFilter.prototype = {
initialize: function() {},
getFilteredDescription: function(current) {
var description = '';
var gr = new GlideRecord('item_option_new '); // Table storing variable selections
gr.addQuery('request_item', current.sys_id);
gr.query();
while (gr.next()) {
var variable = gr.sc_item_option;
var variableValue = variable.value;
if (variableValue == 'true') { // Check if checkbox is checked
description += variable.getDisplayValue() + ', ';
}
}
return description.trim().slice(0, -1); // Remove last comma
},
type: 'RITMDescriptionFilter'
};
Business rule :
(function executeRule(current, previous /*null when async*/) {
var descFilter = new RITMDescriptionFilter();
current.description = descFilter.getFilteredDescription(current);
})(current, previous);
If this helped, please mark it as a solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2025 06:00 PM
update script which is adding the description
Is it a BR or Workflow which is adding it?
Add a if statement and check if the value is true or false based on that make decision
Please share the script so that it will be easy to help
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2025 10:10 PM
which script you are using to populate the description?
there you can check if the variable value is False then don't add
share that script and I can enhance it.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader