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.

Hiding mandatory fields..

gaz624
Mega Contributor

Hi, I'm looking to not display some mandatory fields in certain scenarios. I will fill them with "n/a" just so that the form can be submitted.

I've tried this with a non-mandatory field an it has worked ok.                  

function onLoad() {

          If (matches conditions){

                    g_form.setDisplay('description', false);     //works

                    g_form.setDisplay('u_what_are_the_benefits_of_imp',false);   //doesn't work

            }

}

But when trying the same with some other fields its not working. I'm guessing because they are mandatory?

Is there a way around this?

Thanks

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

If there is a mandatory field you cant make it read only or hide it, so before you have to hide you make the field non mandatory.



Similarly, if a field is read only you cant make it mandatory, you first need to make it editable n then make it mandatory.


-Anurag

View solution in original post

16 REPLIES 16

google1
Kilo Contributor

how can i create an average resolution time on reports in service now? Any help would be appreciated.


Hello Meena,



That would be a separate question. I suggest you place this as a new question.