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.

widget button to only appear at certain states

asd22
Tera Contributor

Hello

 

i have a widet checkbox i only want to show in the form at a certain state. And be hidden and not mandatory at other times. How can i do this? the reason i made it a widget checkbox is i did not manage to make it a mandatory variable on the form itself.

3 REPLIES 3

soumyadeep10
Giga Guru

Could you provide a screenshot of the form with the field in it.

prajaktajga
Tera Contributor

Hello @asd22 ,

 

If Its a Catalog Item you can go with the UI Policy to make the field

1.As this is the widget client script and UI Policy will not work here can you just elaborate it more or provide whether it is a widget or catalog Item. Or provide any screenshots for reference.

adityahubli
Tera Contributor

Hello @asd22 ,

If you want to show check box based on certain state you can reffer following code :

 

<div>
<label for="mySelect">Choose an option:</label>
<select id="mySelect"
name="mySelect"
ng-model="c.selectedState">
<option value="">-- Select --</option>
<option value="New">New</option>
<option value="In Progress">In Progress</option>
<option value="Resolved">Resolved</option>
</select>

<div ng-show="c.selectedState == 'Resolved'">
Yes or no
<input type="checkbox" id="checkbox1" name="option1" value="option1">
</div>
</div> 

 

Checkbox should visible only for resolved state otherwise remains hidden.

 

adityahubli_0-1764158448416.pngadityahubli_1-1764158472896.png

 

 

 

If this helps you mark it as helpfull and accept as solution for others future queries.

Regards,

Aditya