How to clear value of a 'sn-record-picker' on click of a button

Revathi10
Tera Expert

I have a sn-record-picker and I have a Clear button. I want to clear the value of sn-record-picker onclick of the button.

I am also using this Clear button to clear the value of other label fields as well.

 

Code for sn-record-picker:

<sn-record-picker id="contract" name="contract" field="c.loc" table="'country'" display-field="'country.name'" display-fields="'sys_class_name'" value-field="'sys_id'" search-fields="'country.name'" page-size="20" multiple="false" ng-change="cichanged()"></sn-record-picker>

 

Code for Clear Button:
<input type="button" class="btn btn-primary btn-block text-overflow-ellipsis ng-binding ng-scope button" id="button1" style="width:100px" onclick="myFunction()" value="Clear Data">

<script>
function myFunction() {

document.getElementById("contract").value='';
}
</script>

 

Could you please help me with this.

 

Many Thanks

0 REPLIES 0