making a variable on a task mandatory based on the Task State

patricklatella
Mega Sage

hi all,

seeing several threads on this topic, but wondering what the right solution would be.

I've got a variable on a catalog item that is only shown on a specific task.   Want the variable to be mandatory if the user selects "Closed Complete" for the state.

Seems simple, but my script isn't working.  

onChange client script?   field I want mandatory is "approval_required".   the script below is not working

anyone know the right way to achieve this?   thanks!

find_real_file.png

1 ACCEPTED SOLUTION

patricklatella
Mega Sage

thanks Shishir, but I actually got it using a System UI Policy.



I was able to set the condition in the builder...and then script the setMantatory in the Script section.   thanks for your help!



find_real_file.png


find_real_file.png


View solution in original post

8 REPLIES 8

Deepak Ingale1
Mega Sage

Please try g_form.setMandatory("approval_required", true) // variables. is not required in client script. It is required when you try to access variables in Server side script


Shishir Srivast
Mega Sage

Looks like you haven't selected the variable name in dropdown.


patricklatella
Mega Sage

Thanks for the replies.   Shishir, "State" isn't a variable, it's a field on the sc_task table...so it's not in the dropdown



Deepak, I tried your suggestion but it didn't work.



does g_form work for the fields on the task?



find_real_file.png