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

You can try using this in a before business rule and add the required condition in business rule.



if (current.state == 3 && current.variables.approval_required=='')


{


        gs.addErrorMessage('Approval is required.');


        current.state = previous_state;


}



Please mark this response as correct or helpful if it assisted you with your question.

g_form works at catalog task as well, infact all the table forms.


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


Great. I was also trying with UI Policy but I was more looking for variable.