How to make a field mandatory based on a choice selected from a variable set

Jesus Nava
Tera Guru

Hello Experts, I have a variable set type Add Row with a variable called "Service" which is a list collector.

find_real_file.png

what i need is that if a user selects "Other" from the list collector, a field that is not in the variable set called "Additional Comments" turns mandatory. I have done this with 2 regular  fields using a UI policy but not for a variable set, can you guide me on how to proceed?

find_real_file.png

Thank you

 

1 ACCEPTED SOLUTION

@Jesus Nava, May Bad!

yes, you are right in that case please revert it back to the variable set. In the run script's Execute if true field use setMandatory syntax like this.

g_form.setMandatory('variables.additional_comments', true);

Execute if false field write below

g_form.setMandatory('variables.additional_comments', false);

Regards,

Muhammad

Regards,
Muhammad

View solution in original post

11 REPLIES 11

Chandu Telu
Tera Guru
Tera Guru

Hi,

Check the below link to make the field mandatory this for your reference

https://community.servicenow.com/community?id=community_question&sys_id=71178fa9dbddc550fd63250913961983

 

Thanks
Chandu Telu
Please Mark āœ… Correct/helpful, if applicable,

Thank you Chandu, reading this post this is for 2 variable sets, I just have one, the other is a regular text field, have you tried it this way?

Thank you

SumanthDosapati
Mega Sage
Mega Sage

Hi,

What did you try? writing an ui policy or client script? on variable set or on catalog?

 

Regards,

Sumanth

Tried with a UI policy in the form and in the VSET with no luck, did not find the UI Actions since I'm using a variable set choice to set a variable outside the VSET mandatory.

Thank you