We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Clear the field value when the chooses the other option.

Not applicable

Hi All, 

 

Based on 1 option selection two will get visible on the form whenever on 2 option selection the value entered into the two fields need to clear out. 

 

do we need to create a new ui policy or any other way to achieve this.

 

 

Need suggestions.

1 ACCEPTED SOLUTION

Not applicable

@Community Alums you can also achieve this by using onChange client script.

 

if(g_form.getValue("variable name")=="option2"){

g_form.clearValue("variable name 1");

g_form.clearValue("variable name 2")

}

Hope this will help you or let me know with more explaining about your requirement to help you further.

View solution in original post

3 REPLIES 3

Not applicable

@Community Alums you can also achieve this by using onChange client script.

 

if(g_form.getValue("variable name")=="option2"){

g_form.clearValue("variable name 1");

g_form.clearValue("variable name 2")

}

Hope this will help you or let me know with more explaining about your requirement to help you further.

Not applicable

@Community Alums 

is there any possibility to get this achieve on the same ui policy that created for the visibility of the two fields when option 1 is selected.

 

PA001
Mega Sage

Hello,

 

Create UI policy and use the script section to clear the field values.

 

Please mark my response as Correct / Helpful

Thanks