How get values from sn-record picker if multi select is set to true

shiva10
Tera Contributor

Hi all,

 

I have added a sn-record to input multiple user reference names and try to get the sys_id of the user

 

<sn-record-picker field="c.user_sys_id"  multiple="true"  id="selectmember" table="'sys_user'" display-field="'name'" on-change="getNewOwner(c.user_sys_id)" default-query="'nameISNOTEMPTY^active=true^user_name!=NULL'" value-field="'sys_id'"  search-fields="'name,user_name,email'"></sn-record-picker>

 

 I am able to get the data in client script

$scope.callAddmember = function(){
c.data.action='addMember';
var userSys_id= c.user_sys_id.value;

}

but the problem is when i extract the value not able to spilt() by comma i think its returining the value of the user_sys_id as string 

so not able to  split and get data

 

 

1 REPLY 1

Anand Kumar P
Giga Patron
Giga Patron

Hi @shiva10 ,

You can split like below and use for loop.

$scope.callAddmember = function() {
    c.data.action = 'addMember';
    var userSysIds = c.user_sys_id.value.split(','); 
    for (var i = 0; i < userSysIds.length; i++) {
        var userSysId = userSysIds[i].trim(); 
        //
    }
}

Please mark it helpful and solution proposed if it works.

Thanks,

Anand