Add default option
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 12:41 AM
Hello experts,
Add Business rule to the “Service” cmdb table. This will run on query, and if the 'operational_status' field is not included in the query, add operational_status = operational.
Any help appreciated.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 12:56 AM - edited 10-16-2023 12:56 AM
// add this to excisting conditions
if(!(current.getEncodedQuery().includes('operational_status')){
current.addQuery('operational_status' , 'operational');
Please try above code.
Please mark my answer as correct and helpful if it solves your issue
Thanks,
Phanindra.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 01:35 AM
@psphanindrakuma can you please check my previous script. if it is correct or not ?
if (current && !gs.nil(current.operational_status)) {
// current.addQuery('operational_status', 'Operational');
// gs.info("Added operational_status=Operational to the query.");
// } else {
// gs.info("Skipped adding operational_status to the query. Current or operational_status is null.");
// }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 01:39 AM - edited 10-16-2023 01:40 AM
@psphanindrakuma I have used you script the in the list it doesn't show any records

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 01:43 AM
if ( !gs.nil(current.operational_status)) {
current.addQuery('operational_status', 'Operational');
}