Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Generate an Error Message in a Requested Item

vcaracci75
Tera Expert

I have created a requested item to create/modify a SharePoint site. If the request type field is Permissions Management, at lest one of the Level of Access fields needs to be filled out (see screenshot). If at lest one is not filled out, I need to generate an error message. I'm not quit sure how to do this. Any assistance would be greatly appreciated.

1 ACCEPTED SOLUTION

jonsan09
Giga Sage
Giga Sage

It sounds like you could leverage a catalog client script and use g_form.showFieldMsg (https://developer.servicenow.com/dev.do#!/reference/api/zurich/client/c_GlideFormAPI#r_GF-ShowFieldM...)

View solution in original post

2 REPLIES 2

jonsan09
Giga Sage
Giga Sage

It sounds like you could leverage a catalog client script and use g_form.showFieldMsg (https://developer.servicenow.com/dev.do#!/reference/api/zurich/client/c_GlideFormAPI#r_GF-ShowFieldM...)

Syed14
Mega Guru

You can create an Onsubmit catalog client script. First, Check request type is 'Permission Management'. Add 'IF ELSE' condition, if all the level of access fields are empty, show an error message.

For example:

If(g_form.getValue(level_1) || g_form.getValue(level_2) || g_form.getValue(level_3) ){

return true;

//if any of the above fields have value this IF will return 'true' }

else{

alert('Kindly fill at least one Level of Access fields ');

return false;

}