User has to submit only 'one request' for only that particular 'one day'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 08:57 AM
Hi All,
Need suggestion on this one requirement.
That user has be restricted to submit multiple requests. He has to submit only one request for particular one day.
we are having three fields on the form
1- Requested for
2- Company
3- Additional Information.
Need help to achieve this requirement. to submit multiple request for single day.
Regards,
Vinod.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 09:03 AM
You could probably write a display business rule to check if the user has created any requests already that day, if they have then throw up an error message telling them they can't create more. There are options available from there, i would probably populate a hidden checkbox to false and then make all fields read-only based on that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 09:17 AM
Hi Vinod,
Go through below thread : Restrict "requested for" user to raise multiple request
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 09:29 AM
Hi,
Create new before insert business rule with below code
var grScRequest = new GlideAggregate('sc_request');
grScRequest .addAggregate('COUNT');
grScRequest.addEncodedQuery('sys_created_onONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)')
grScRequest.addEncodedQuery("requested_for="+gs.getUserID()+"^stateNOT IN3,4,7");
grScRequest.query();
while (grScRequest.next()) {
if(grScRequest.getAggregate('COUNT') > 1){
gs.addErrorMessage("ADD YOUR MESSAGE HERE");
current.setAbortAction(true);
}
}