I am not getting values in Client controller

Priya75
Tera Contributor
 //server script

else if (input.action == 'impHostingloc') {
var hostingLocation=input.name;
data.cloudServiceProvideList =[]:
var cloudService=(};
if(hostingLocation=="Public"){
var cloudPro = new GlideRecord('sn_capi_provider');
cloudPro.addQuery ("u_cloud_service_provider_type", hostingLocation);
cloudPro.query();
while (cloudPro.next)) {
//gs. info("inside while"+input.name);
cloudService.label=cloudPro.getValue('name');
cloudService.value=cloudPro.sys_id.toStringO;
data.cloudServiceProvideList.push(cloudService);
}
}
else if(hostingLocation=="Private"){
var cloudProdl = new GlideRecord("sn_capi_provider"):
cloudProd1. addQuery ("U_cloud_service_provider_type", hostingLocation)
cloudPro1.query();
while(cloudProdl.next()){
gs. info("inside while"+input, name); 
cloudService.label=cloudProd1,getValue('name');
cloudService.value-cloudProd1.sys_id.toString();
data.cloudServiceProvideList.push(cloudService);
}

else if (input.action == 'getServiceName') {
var ids=input.ids;
data. name= [];
var gr1=new GlideRecord("sn_capi_provider") gr1. addQuery('sys_id', 'IN',ids);
gr1. query);
while (grl.next )
date.name. push(gr1.getValue('name '));
gs. info ("data"+data. name) ;
);



//client Controller

c.cloudService=[];
c.getHostLoc = function() {
var hostingLoc=c.hostloc.displayValue;
console. log("hostinglocation"+c.hostloc.displayValue);
if(hostingLoc==""){
c.cloudservprov='';
}
this.server.get({
action: "impHostingloc" ,
name: hostingLoc,
//listservice: selectedcloud
}).then (function(response) {
c.cloudservprovlist= response.data.cloudServiceProvidelist;
console.log("1891"+c.cloudservprovlist);
}


c.updateSelected =function (){
var selectedCloudService=c.cloudservprov;
console.log("response"+selectedCloudService);
if(selectedCloudService && selectedCloudService. length›0)(
this.server.get ({
action: "getServiceName",
 ids: selectedCloudService
}).then (function(response){
c.cloudService=response.data.name.join ',');
console.log("response"+c.cloudService);

}

//HTML
<sn-choice-list sn-model="c.cloudservprov" table="sn_capi_provider" display-field="name" value-fied='sys_id'
sn-items=c.cloudservprovList" multiple="true" on-change="c.updateSelected()"</sn-choice-list >

i am trying to get the values selected by the user , but in the console i am not getting all the values for eg:- first value is skipped first time and then it appears second time , so if i select 4 values only 3 are getting updated

var selectedCloudService=c.cloudservprov;
console.log("response"+selectedCloudService

0 REPLIES 0