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

Community Alums
Not applicable

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.

3 REPLIES 3

Not applicable

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.

Chetan Mahajan
Kilo Sage
Kilo Sage

Hi Vinod,

                   Go through below thread : Restrict "requested for" user to raise multiple request

Kindly mark correct and helpful if applicable

Mahesh23
Mega Sage

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);
   }
}