Need help with getting a total count value in Lookup Select Box variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 03:35 PM
Hello,
Our Catalog Item contains a Lookup Select Box variable which getting the data from a custom table(u_books)
We need help on getting the total count of the lookup box value after a form loaded so that we can write conditions.
Could someone please provide suggestion?
we appreciate your help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 10:49 PM
if you just want count of u_book record, simply fetch as below
getBookCount: function() {
var booksCount;
var gr=new GlideRecord("u_book"); //glide the table you want to count rows
//gr.addQuery('active', true); //shows all active records
gr.query(); // query the condition
gs.print(gr.getRowCount()); // counts all the active incidents and prints the number
booksCount=gr.getRowCount();
return booksCount.toString();
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 07:45 AM
Do I remove the entire code in the Catalog Client Script and replace them with the new provided code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 09:21 PM
Hello,
Can someone please continue to provide assistance? I have a select lookup box variable that I'm trying to get the total count when form load. I'm getting a zero data return in an Alert.
Here are the codes, please help review it and make necessary correctly. Thank you
Catalog Client Script: