Restrict the request submission

Community Alums
Not applicable

Hi All, 

 

Having a requirement that, 

 

We are having a catalog form, where it contains three fields

1- Student name (reference to user table)

2- Course( reference to course table)

The validation that we need to set on the form before submission is

> If the student is submited a request for a course (which is active ) restrict the another request submission for the same course. 

> if the student submitted a three course requests need to restrict not to submit another one. (limit is three requests submission which are active. 

 

Need suggestions to achieve this. 

 

2 REPLIES 2

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Community Alums,

 

You can create a onsubmit client script along with Script Include Ajax call checking for no of open request by requested by and see if the active course is already submitted.

 

I hope this logic will help you build the code. Let me know if any questions...


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Soni Tushar
Tera Guru

Hello @Community Alums ,

 

It can be done via the OnSubmit client script.

onSubmit() script runs when a form is submitted. Typically, you use an onSubmit() script to validate things on the form and ensure that the submission makes sense. As such, onSubmit() scripts can potentially cancel a submission by returning false.

 

Please Refer to 

https://www.servicenow.com/community/developer-forum/restrict-user-to-submit-form-via-onsubmit-client-script/m-p/2479262

 

If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!