Documentation for sn-record-picker and sn-choice-list

ryanlitwiller
Giga Guru

Looking for official documentation on sn-record-picker and sn-choice-list or where I can review the directive in the platform.

 

There was a question posted two years ago asking the same thing with a reference to a github repo that is now empty.

1 ACCEPTED SOLUTION

ryanlitwiller
Giga Guru

I was able to find the source in my browser which is a start.

Ultimately looking to see if the sn-record-picker is capable of having a table query as well as allowing for custom text if an entry isn't found, or what kind of modification it would take to enable this with a custom directive.

View solution in original post

6 REPLIES 6

Tommy Jensen
Giga Guru

The original github documentation njow lives here:

https://serviceportal.io/docs/

DPrasna
Tera Contributor

Hello All,

 

I have a custom widget with select box using sn-record-picker.. However, the selected/ chosen value still stays whenever the Modal opens. The requirement is to empty the value every time the Modal opens.

 

Observation: The field populates correctly but if I do not submit the Modal instead cancel it or close it and open it for the second time(without refreshing the page) the username does not clear out. It stays with the last chosen username value. I want that to be emptied in such instances.

 

HTML

 

 

<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label for="firstname"><b>User Name</b></label> 

<sn-record-picker field="c.addUsr.firstname"
table="'sys_user'"
default-query="data.existUserid"
display-field="'name'"
display-fields="'email'"
value-field="'sys_id'"
search-fields="'name,email'"
page-size="100"                 
>
</sn-record-picker>

</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" class="form-control" name="email" disabled required ng-model="c.addUsr.email1">
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" style="color:white;" ng-click="c.addExistinguser(n)" data-dismiss="modal">Submit</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>  
</div>

 

Client

c.addExistinguser=function(n){
c.data.user = {value: c.data.user.name, displayValue:c.data.user.sys_id};			
c.data.action = 'addexistingUser';
c.data.exUser = c.addUsr;
//console.log(c.addUsr);
//console.log(n);
//c.closeexistingUserform(close);		
c.server.update().then(function(){
c.getUserlist();
});
}

//Onload function to populate values
$scope.$on("field.change", function(evt, parms) {			
//console.log(parms.newValue);
c.data.usersysid = parms.newValue;
if(parms.newValue =='')
{
c.addUsr.email1 = '';
c.addUsr.title = '';
c.addUsr.busiphone = '';
c.addUsr.timezone ='';			
}
else{
c.data.action = 'fetchexistingUser';
c.server.update().then(function(){	
c.addUsr.email1 = c.data.existingUser[0].email;
c.addUsr.busiphone = c.data.existingUser[0].busphone;	
c.addUsr.title = c.data.existingUser[0].title;	
c.addUsr.timezone =c.data.existingUser[0].time_zone;					
});	
}
});