- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 03:10 AM
Hi Folks,
Below are the Script include and Onload Catalog Client script.
I have a catalog single line text type variable "available_slots_for_today".
Requirement:
There is a group they can fullfil daily 10 request only.
When user is creating a request we need to show a field with how many requests created today and how many slots are available.
For that I need to update total created request count in current date. And to extend to this the request creation should not be exceed more that 10 request from a catalog item.
Script include:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 03:32 AM
your script include should be client callable and then it will work. Currently it's not.
Ensure the client callable checkbox is true and update script as this
var RecordCounter = Class.create();
RecordCounter.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRecordCount: function() {
var gr = new GlideRecord('sc_request');
gr.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
gr.query();
return gr.getRowCount();
},
type: 'RecordCounter'
});
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 03:52 AM
Can you post a new thread for your new question and share all the details there along with script and screenshots
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader