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.

scripts to check variable is empty or not

TMKAM
Tera Contributor

I have create 2 variable as per below

variable A = multiline text

variable B - attachment

 

the above variable is not set as mandatory field and I would like to create a on submit scripts to check base on the below scenario

 

Scenario 1

Variable A = empty

Variable B = empty meaning no attachment

the script should alert with message when requester press order now button

 

Scenario 2

Variable A = not empty

Variable B = empty meaning no attachment

the script is not alert with message and requester can press order now button

 

Scenario 3

Variable A = empty

Variable B = not empty meaning got attachment inside

the script is not alert with message and requester can press order now button

 

thank you

15 REPLIES 15

Community Alums
Not applicable

Hi,

 

Please add "alert(attachment)" below the line "var attachment = g_form.getValue("u_attach_option_feature_request");" then attach the file and submit to examine its value.