- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
17 hours ago - last edited 17 hours ago
I want to run "Update Resource Capacity" UI action from background script. I will be passing user id, start date as current date, end date as current date+18 months.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
16 hours ago
something like this
var userSysId = 'YOUR_USER_SYS_ID'; // Replace with actual user sys_id
var startDate = new GlideDateTime(); // Today
var endDate = new GlideDateTime();
endDate.addMonthsLocalTime(18);
var CapacityGenerationAPI = new CapacityGenerationAPI();
// Method 1: Update single user (recommended)
CapacityGenerationAPI.updateCapacityAndAvailabilityForUsers([userSysId], startDate, endDate);
gs.info('Resource capacity updated for user: ' + userSysId + ' from ' + startDate + ' to ' + endDate);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
16 hours ago
something like this
var userSysId = 'YOUR_USER_SYS_ID'; // Replace with actual user sys_id
var startDate = new GlideDateTime(); // Today
var endDate = new GlideDateTime();
endDate.addMonthsLocalTime(18);
var CapacityGenerationAPI = new CapacityGenerationAPI();
// Method 1: Update single user (recommended)
CapacityGenerationAPI.updateCapacityAndAvailabilityForUsers([userSysId], startDate, endDate);
gs.info('Resource capacity updated for user: ' + userSysId + ' from ' + startDate + ' to ' + endDate);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
14 hours ago
This script works , it runs only for resource managers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
15 hours ago
When I click "Update Resource Capacity" from UI action. It creates data in "Resource aggregate weekly" and "Resource Aggregate Monthly" tables. when I run the background script I'm not seeing data in these tables. I want to replicate exact steps what is done in the UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
15 hours ago
that UI action calls UI page and a script include via GlideAjax
you need to understand what's being passed etc and how
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
