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.

How to identify mandatory fields in Client Script

harinalamalapu
Giga Expert

I want to identify the mandatory fields (something like g_form.isMandatoryFieldEmpty) in a Client Script to add a field message (error message) for all such fields when left blank on the form. Can you think of a way to iterate through the fields on the form and check if they are mandatory but empty?

Note: I can hard code the required fields in the script to add field message. But I am trying to identify an alternative way where I should identify only the mandatory fields to add field message so that script need not be updated again in future when a new field is made mandatory.

1 ACCEPTED SOLUTION
5 REPLIES 5

harinalamalapu
Giga Expert

Hi Michael, This post helped. thank you.