- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 11:52 PM
Hi all,
my third party is providing me the list of application services and its blackout values in the below format
var reqData = {
"ID": "8611",
"Details": "INPAT:SBBW_Monday_14:16_R0",
"Recurrence": "Monthly",
"StartTime": "06/05/2024 14:00:06",
"EndTime": "06/05/2024 16:00:16",
"MType": "Day of the month",
"Application": [{
"AppName": "DI_metal_app_service"
},
{
"AppName": "DI_metal_app_service1"
},
{
"AppName": "DI_metal_app_service2"
}
]
}
how to populate the application services name in the below format in the blackout schedule
I have tried the below code but it does not help me
var conditiona = "";
var gr = new GlideRecord('cmn_schedule_blackout');
gr.addQuery('sys_id', 'e518327987b9829c49aa0d030cbb350c');
gr.query();
if (gr.next()) {
gs.info('dsssdggg:,.........................' + gr.source);
var arrayUtil = new global.ArrayUtil();
for (var i = 0; i < reqData.Application.length; i++) {
var appName = reqData.Application[i].AppName;
gs.info('appName..........' + appName);
if (conditiona) {
conditiona += "OR";
}
conditiona += '("ref_cmdb_ci_service_auto.name="' + appName + ' ")' ;
}
}
gr.condition = "(" +conditiona + ")";
gr.update();
please provide me a solution if possible.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 01:45 AM
By using the "IN" operator you're able to execute a much more efficient query. OR conditions in SQL are much slower and impact instance performance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 01:45 AM
By using the "IN" operator you're able to execute a much more efficient query. OR conditions in SQL are much slower and impact instance performance