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.

Clear the field value when the chooses the other option.

Community Alums
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

Community Alums
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

Community Alums
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.

Community Alums
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