Catalog with 'Available for' as empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 08:56 AM - edited 04-16-2024 08:57 AM
Hi everyone,
How to get a list of catalog item names from the 'sc_cat_item' table where the 'Available for' related tab has no records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 09:29 AM
Hi @swapnil15
try edit in catalog builder ,
Determine the correct table and relationship that defines what “Available For” means. This might involve a many-to-many table or a condition based on user or group relationships.
The script is hypothetical as the specific tables and relationships for “Available For” need to be identified.
Business rule or use it in background script
var catItemsWithoutRelatedRecords = [];
var catItemGR = new GlideRecord('sc_cat_item'); // Catalog Item table
catItemGR.query();
while(catItemGR.next()) {
var relatedRecordGR = new GlideRecord('related_table'); // The related table that defines “Available For”
relatedRecordGR.addQuery('catalog_item', catItemGR.sys_id); // Assuming the relationship is stored here
relatedRecordGR.query();
if (!relatedRecordGR.hasNext()) { // No related records found
catItemsWithoutRelatedRecords.push(catItemGR.getValue('name')); // Collecting item names
}
}
// Example output to log (or adapt to your needs)
gs.info(‘Catalog Items without related records: ’ + catItemsWithoutRelatedRecords.join(’, '));
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning
Thanks & Regards
Deepak Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 09:32 AM
Hi @swapnil15 ,
Below thread on community might help you.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Ranjit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 09:44 AM
You would probably have to create a Database view between the two tables with a left join.