Block subscription if the license number is reached in a catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2025 01:07 AM
I need to add changes to an existing catalog item ->
block the form if the number of subscribers + active requests Teams Premium offer > 200
The value 200 must be configurable via a sysproperty
Set a sysproperty value > number of subscribers + requests in progress (at least 1) => Possibility to order
1 Set a sysproperty value < number of subscribers + current requests (at least 1) => Blocked order
2 The "Submit" button remains visible in all cases
Content of the form
Existing
1-> Requester R (user) O N always
2-> Beneficiary R (user) Mandatory Always visible
----------------------------------------
Modification to be made :
3-> Description of the need ->TB - Mandatory - Visible, Modification request by profession => Visibility conditions If nb licenses < 200
3.1-> The maximum number of Teams Premium licenses at XXXX has been reached. You can join the waiting list. L Change request by business => If nb licenses >= 200 (Budget approval fields)
L (label), TB (text box), TM (multi-line text), LD (drop-down list), LC (combo list), LM (multiple choice list), RB (radio button), CC (checkbox), S (Section), R (reference)
[ ] Nb licenses = Number of subscribers to the Teams Premium offer with Active = true + Requests with Active = true on this form [ ] The number 200 must be configurable via a sysproperty. [x] Block the form if the beneficiary is already subscribed to the Teams Premium offer (in the existing one) [ ] Block the form if nb licenses >= 200 with the error message (if not possible to put a link, delete the 2nd sentence): The number maximum Teams Premium licenses at XXX has been reached. You can join the waiting list.
i don't know if this can help but there's is a general script includes I could find this script :
setSubscription: function(user, service_offering) {
var checkDuplicateSubscription = new GlideRecord('service_subscribe_sys_user'); checkDuplicateSubscription.addQuery("sys_user", user);
checkDuplicateSubscription.addQuery("service_offering", service_offering); checkDuplicateSubscription.addQuery("u_active", true);
checkDuplicateSubscription.query();
if (!checkDuplicateSubscription.hasNext()) {
var createSubscription = new GlideRecord('service_subscribe_sys_user');
createSubscription.newRecord();
createSubscription.service_offering = service_offering; createSubscription.sys_user = user;
createSubscription.insert();
}
},