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.

Catalog Item variable mandatory on only one task

Jason Stephens
Kilo Guru

I need to make a catalog item variable mandatory on only one task. I do not need it to be mandatory when submitted, I just need it to be mandatory on one of the tasks that get generated by the workflow.

Thanks for the help.

Jason

1 ACCEPTED SOLUTION

DrewW
Mega Sage

have you tried

!g_form.getValue("variables.myvar").isNul()


View solution in original post

24 REPLIES 24

Well I ran into a small issue. I need to check for the presence of my variable. As of now, this script runs on every task. I'm not sure of the syntax on that. I need something like:

if (action == 'close_task' && current.variables.lease_new_machine is present)

Not really sure how to check for "presence"...




DrewW
Mega Sage

have you tried

!g_form.getValue("variables.myvar").isNul()


That got it. Thanks!


elphilli
Tera Contributor

Where are you scripting this at? 

Jim Coyne
Kilo Patron

Hey Jason, check out the following post, it might be helpful - Saving a record without populating all mandatory variables