- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:40 AM
Hi,
We have a requirement for multiple selection, so we have created the variables of type checkbox, now when the request is submitted the unchecked variable is visible in the Additional details of esc portal.
I have gone through the solution of How to hide unchecked checkbox variable on Self Portal.
Now I have clone the variable summarizer widget and made the changes, but I need a help on how to call this widget for my Service Catalog, what are steps for calling the Copy of Variable summarizer and how to test it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 03:52 AM
the link you shared already has working solution.
Did you update this record? try giving your custom widget here
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 03:57 AM
@jyotisaroj adding to my previous mail
Change the type to custom and widget field. Your widget, use this only if your widget is correctly configured. Else use "Variables read only as recommended by SN"
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 05:16 AM
this worked for me in the cloned widget.
HTML: No change here actually
<div ng-if="c.data.variables.length > 0" ng-init="c.variable_toggle = c.toggle">
<button class="btn variables-toggle-btn" aria-expanded="{{c.variable_toggle}}" aria-label="{{data.ariaLabel}}" ng-click="c.variable_toggle = !c.variable_toggle" ng-if="!c.hide_control">
<span style="font-size: 12px;" class="glyphicon" ng-class="c.variable_toggle ? 'glyphicon-chevron-down' : 'glyphicon-chevron-up'"></span>
{{data.label}}
</button>
<div ng-if="c.variable_toggle" id="variables-toggle" aria-hidden="{{!c.variable_toggle}}">
<hr role="presentation" ng-if="!c.hide_control">
<div class="m-b break-word" ng-repeat="variable in c.data.variables">
<label class="m-t-xs m-b-none text-muted"><b>{{::variable.label}}</b></label>
<div ng-if="!variable.multi_row">
<div ng-switch="variable.type">
<!-- 27 is type URL, 33 is type Attachment -->
<a ng-switch-when="27" class="pre-wrap" title="{{::variable.label}}" href="{{::variable.display_value}}" target="_blank">{{::variable.display_value}}</a>
<span ng-switch-when="33" class="file-attachment">
<a ng-if="::variable.state != 'not_available'" class="pre-wrap" title="{{::variable.label}}" href="javascript:void(0);" ng-click="scanAttachment(variable)" aria-label="${Download {{variable.display_value}}}">{{::variable.display_value}}</a>
<span ng-if="::variable.state == 'not_available'" class="error">
<a class="pre-wrap" title="{{::variable.label}}" href="javascript:void(0);" ng-click="scanAttachment(variable)" aria-label="${File {{variable.display_value}} failed security scan}">{{::variable.display_value}}</a>
(${File failed security scan})
</span>
</span>
<span ng-switch-default class="pre-wrap">{{::variable.display_value}}</span>
</div>
</div>
<div ng-if="variable.multi_row">
<a href="javascript:void(0)" id="{{ 'popoverLink' + $index }}" class="hidden-xs" aria-haspopup="true" aria-expanded="false" ng-click="c.togglePopover($index)"
uib-popover-template="'sp_multirow_vs_summarizer.html'" popover-title="{{variable.label}}" popover-placement="auto top" popover-append-to-body="true" popover-trigger="none" popover-is-open="c.isPopoverOpen[$index]">{{::c.getMrvsLink(variable)}}</a>
<a href="javascript:void(0)" class="visible-xs" ng-click="c.openMrvsModal(variable)">{{::c.getMrvsLink(variable)}}</a>
</div>
</div>
</div>
</div>
Server Script: changes made here
(function() {
data.label = options.label || gs.getMessage("Options");
if (options.task)
data.ariaLabel = gs.getMessage("{0} for {1}", [data.label, options.task]);
else
data.ariaLabel = data.label;
if (options.variables) {
data.variables = filterVariables(options.variables);
return;
}
data.labelClose = gs.getMessage("Close");
var tableName = options.table || $sp.getParameter('table');
var sysId = options.sys_id || $sp.getParameter('sys_id');
if (!new global.SPWidgetAccessControl().hasPublicAccess(tableName, $sp, options, input)) {
gs.warn("Deny access to table which is not public: " + tableName);
data.isValid = false;
return;
}
var record = sn_std_tkt_api.TicketConfig.getTicketRecord(tableName, sysId);
if (record == null)
return;
data.canRead = record.canRead();
if (!data.canRead)
return;
data.variables = filterVariables(new GlobalServiceCatalogUtil().getVariablesForTask(record, true));
})();
function filterVariables(variables) {
if (variables == null || variables.length == 0)
return variables;
var filteredVariables = [];
variables.forEach(function(variable) {
if (variable.visible_summary) {
// push the variable only when it's checkbox and true
if (variable.type.toString() == '7' && variable.display_value.toString() == 'true')
filteredVariables.push(variable);
else if (variable.type.toString() != '7') // push all other variables as it is
filteredVariables.push(variable);
}
});
return filteredVariables;
}
Server Side Script highlighted: push checkbox only when value is true
RITM has unchecked variable in variable editor
Unchecked variable is hidden on portal:
Standard ticket config record:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 04:27 AM
did you add some static HTML and see if your new widget is rendered?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 04:33 AM
Yes, as per the article i have modified
<div ng-if="variable.type !='7' || (variable.type == '7' && variable.display_value != 'false')">
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 05:16 AM
this worked for me in the cloned widget.
HTML: No change here actually
<div ng-if="c.data.variables.length > 0" ng-init="c.variable_toggle = c.toggle">
<button class="btn variables-toggle-btn" aria-expanded="{{c.variable_toggle}}" aria-label="{{data.ariaLabel}}" ng-click="c.variable_toggle = !c.variable_toggle" ng-if="!c.hide_control">
<span style="font-size: 12px;" class="glyphicon" ng-class="c.variable_toggle ? 'glyphicon-chevron-down' : 'glyphicon-chevron-up'"></span>
{{data.label}}
</button>
<div ng-if="c.variable_toggle" id="variables-toggle" aria-hidden="{{!c.variable_toggle}}">
<hr role="presentation" ng-if="!c.hide_control">
<div class="m-b break-word" ng-repeat="variable in c.data.variables">
<label class="m-t-xs m-b-none text-muted"><b>{{::variable.label}}</b></label>
<div ng-if="!variable.multi_row">
<div ng-switch="variable.type">
<!-- 27 is type URL, 33 is type Attachment -->
<a ng-switch-when="27" class="pre-wrap" title="{{::variable.label}}" href="{{::variable.display_value}}" target="_blank">{{::variable.display_value}}</a>
<span ng-switch-when="33" class="file-attachment">
<a ng-if="::variable.state != 'not_available'" class="pre-wrap" title="{{::variable.label}}" href="javascript:void(0);" ng-click="scanAttachment(variable)" aria-label="${Download {{variable.display_value}}}">{{::variable.display_value}}</a>
<span ng-if="::variable.state == 'not_available'" class="error">
<a class="pre-wrap" title="{{::variable.label}}" href="javascript:void(0);" ng-click="scanAttachment(variable)" aria-label="${File {{variable.display_value}} failed security scan}">{{::variable.display_value}}</a>
(${File failed security scan})
</span>
</span>
<span ng-switch-default class="pre-wrap">{{::variable.display_value}}</span>
</div>
</div>
<div ng-if="variable.multi_row">
<a href="javascript:void(0)" id="{{ 'popoverLink' + $index }}" class="hidden-xs" aria-haspopup="true" aria-expanded="false" ng-click="c.togglePopover($index)"
uib-popover-template="'sp_multirow_vs_summarizer.html'" popover-title="{{variable.label}}" popover-placement="auto top" popover-append-to-body="true" popover-trigger="none" popover-is-open="c.isPopoverOpen[$index]">{{::c.getMrvsLink(variable)}}</a>
<a href="javascript:void(0)" class="visible-xs" ng-click="c.openMrvsModal(variable)">{{::c.getMrvsLink(variable)}}</a>
</div>
</div>
</div>
</div>
Server Script: changes made here
(function() {
data.label = options.label || gs.getMessage("Options");
if (options.task)
data.ariaLabel = gs.getMessage("{0} for {1}", [data.label, options.task]);
else
data.ariaLabel = data.label;
if (options.variables) {
data.variables = filterVariables(options.variables);
return;
}
data.labelClose = gs.getMessage("Close");
var tableName = options.table || $sp.getParameter('table');
var sysId = options.sys_id || $sp.getParameter('sys_id');
if (!new global.SPWidgetAccessControl().hasPublicAccess(tableName, $sp, options, input)) {
gs.warn("Deny access to table which is not public: " + tableName);
data.isValid = false;
return;
}
var record = sn_std_tkt_api.TicketConfig.getTicketRecord(tableName, sysId);
if (record == null)
return;
data.canRead = record.canRead();
if (!data.canRead)
return;
data.variables = filterVariables(new GlobalServiceCatalogUtil().getVariablesForTask(record, true));
})();
function filterVariables(variables) {
if (variables == null || variables.length == 0)
return variables;
var filteredVariables = [];
variables.forEach(function(variable) {
if (variable.visible_summary) {
// push the variable only when it's checkbox and true
if (variable.type.toString() == '7' && variable.display_value.toString() == 'true')
filteredVariables.push(variable);
else if (variable.type.toString() != '7') // push all other variables as it is
filteredVariables.push(variable);
}
});
return filteredVariables;
}
Server Side Script highlighted: push checkbox only when value is true
RITM has unchecked variable in variable editor
Unchecked variable is hidden on portal:
Standard ticket config record:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 05:28 AM
You can mark this response correct as well so that it helps future members in community.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 06:11 AM
Thanks a lot @Ankur Bawiskar,
I can still see that "Additional Details" is empty.
Here's what I have did according to the solution
I have clone the widget of Variable Summarizer.
HTML:
Server Script:
(function() {
data.label = options.label || gs.getMessage("Options");
if (options.task)
data.ariaLabel = gs.getMessage("{0} for {1}", [data.label, options.task]);
else
data.ariaLabel = data.label;
if (options.variables) {
data.variables = filterVariables(options.variables);
return;
}
data.labelClose = gs.getMessage("Close");
var tableName = options.table || $sp.getParameter('table');
var sysId = options.sys_id || $sp.getParameter('sys_id');
if (!new global.SPWidgetAccessControl().hasPublicAccess(tableName, $sp, options, input)) {
gs.warn("Deny access to table which is not public: " + tableName);
data.isValid = false;
return;
}
var record = sn_std_tkt_api.TicketConfig.getTicketRecord(tableName, sysId);
if (record == null)
return;
data.canRead = record.canRead();
if (!data.canRead)
return;
data.variables = filterVariables(new GlobalServiceCatalogUtil().getVariablesForTask(record, true));
})();
function filterVariables(variables) {
if (variables == null || variables.length == 0)
return variables;
var filteredVariables = [];
variables.forEach(function(variable) {
if (variable.visible_summary) {
// push the variable only when it's checkbox and true
if (variable.type.toString() == '7' && variable.display_value.toString() == 'true')
filteredVariables.push(variable);
else if (variable.type.toString() != '7') // push all other variables as it is
filteredVariables.push(variable);
}
});
return filteredVariables;
}
-----------------------------------------------------
Changed the ticket Tab configuration.
All the steps I have followed still I can see the empty Additional Details.