How to override record picker close/reset button ?

AmitK9211638133
Giga Contributor

 As per the requirement, on reset/close of record picker it should not reset all the data bind to the controller. Is there any way to do it? Right now record picker on reset it clears all the values bound the the component. which also clears the result set displaying. user just wants to clear selected value and not the records in record picker. Tried saving the value in another variable but using value field and ng-model but its not working.

1 REPLY 1

Samaksh Wani
Giga Sage
Giga Sage

Hello @AmitK9211638133 

<sn-record-picker
  value="c.data.selectedUser"
  table="'sys_user'"
  display-field="'name'"
  search-fields="'name,email'"
  on-change="c.onUserChanged()">
</sn-record-picker>

 

In your Client Controller script :-

 

c.onUserChanged = function () {
  if (c.data.selectedUser) {
    // User selected — fetch related data
    c.data.resultSet = fetchDataBasedOnUser(c.data.selectedUser);
  } else {
    // Do NOT clear resultSet — just leave it as-is
    // Optionally: let user manually clear result if needed
  }
};

 

Pls mark my solution as accept and thumbs up if you find it helpful. It will help other users on community to find helpful response.

 

Regards,

Samaksh Wani