Business Rule

SIVAKARTHICS
Tera Contributor
   
    var gr = new GlideRecord("x_1622035_meeting_request_room");
    gr.addQuery("room_no" , current.variables.room_name.name);
    gr.addQuery("start_date" , "<=" , current.variables.end_date);
    gr.addQuery("end_date" , ">=" , current.variables.start_date);
    gr.query();
     if(gr.next()){
        gs.addErrorMessage('This room is already booked for the selected time range');
        current.setAbortAction(true);
       
    }
 
 
this is my code i need to prevent user from submitting the catlog  item if the above conditions satisfies. the error message is working properly also catlog item submits.. my abort action is not working. how to i prevent user from submitting the catlog item
2 REPLIES 2

anshul_goyal
Kilo Sage

Hello @SIVAKARTHICS,

If you want to abort catalog item submission then use onSubmit() Catalog Client Script instead of Business Rule.
Refer below community link: 
https://www.servicenow.com/community/developer-forum/abort-submission-of-catalog-item/m-p/1703933
https://www.servicenow.com/community/itsm-forum/prevent-catalog-item-from-being-submitted-if/td-p/47...

Please mark my response as Accepted and Helpful for future references.

Thanks

@SIVAKARTHICS,

Thank you for marking my response as helpful.

As per new community feature you can mark multiple responses as correct.

If my response helped please mark it correct as well so that it benefits future readers.

Regards,