Restrict user to submit form (via onSubmit Client script)

Elena Pomana
Tera Guru

Hello,

 

My requirement is to restrict submit option if a user is part of a certain group.

The user needs to access the catalog item and should be able to see all the variables in it (which are set to read only) but if submit button is clicked, an error should appear and the submission shouldn't be allowed.

 

Things I have tried:

Script include:

ElenaPomana_0-1676475061160.png

Client script onSubmit:

1st version:

ElenaPomana_2-1676475099136.png

2nd version:

ElenaPomana_3-1676475179119.png

I have tried with XMLWait as well but the method is no longer used.

 

Thank you.

Elena

1 ACCEPTED SOLUTION

Let me know what do you guys think, I managed to solve it this way:

Script include:

ElenaPomana_0-1676539602212.png

Client script:

ElenaPomana_1-1676539642248.png

Tested it both ways(user part of group, user that isn't part of the group) and it seems that it works as expected.

 

Thank you for all the ideas, you guys are amazing!

 

Have a great day,

Elena

 

View solution in original post

11 REPLIES 11

@Ankur Bawiskar Yes, worked for both.

@Elena Pomana 

Thanks for sharing the info..

Happy learning..!!

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader