- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 01:15 AM
Hi All
My requirement is, if '5b806c328396c6105fc86770deaad354' is present in 'entitlements' then remove it from 'entitlements'. Can someone please suggest what is wrong with the code.
TIA!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 01:20 AM - edited 05-16-2025 01:20 AM
You can take this sample code as reference
var array_entitlements = ['a', 'b', 'c'];
const index = array_entitlements.indexOf('b');
if (index !== -1) {
array_entitlements.splice(index, 1); // Removes 'b' at the found index
}
console.log(array_entitlements); // Output: ['a', 'c']
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 01:20 AM - edited 05-16-2025 01:20 AM
You can take this sample code as reference
var array_entitlements = ['a', 'b', 'c'];
const index = array_entitlements.indexOf('b');
if (index !== -1) {
array_entitlements.splice(index, 1); // Removes 'b' at the found index
}
console.log(array_entitlements); // Output: ['a', 'c']
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 01:20 AM
Hi @Ankita9793 ,
Try this
var entitlements = ['0678191f1b13a4d06c3c2f007e4bcb9b', '5b806c328396c6105fc86770deaad354'];
var mdmadldsgrp = '5b806c328396c6105fc86770deaad354';
var cat_item = 'Mobile - NEW';
if (cat_item == "Mobile - NEW") {
var index = entitlements.indexOf(mdmadldsgrp);
if (index > -1) {
entitlements.splice(index, 1); // Remove the item at the found index
gs.print('Updated entitlements: ' + entitlements);
} else {
gs.print('Group not found in entitlements.');
}
}
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
05-16-2025 01:29 AM
Hi @Ankita9793 ,
line 4 and 5
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Arun Manoj