Virtual Agent Dynamic Choice Input calling Script include

zackss
Tera Contributor

Is it possible to call script include Choice input?

I have a script include that returns an object and this is how I call it in the script inside the Dynamic Choice input. Now I already have tested my script include in the background script and it's working fine but whenever I call it here in the Dynamic Choice input script it does not work, it errors if I don't put global.scriptinclude or i put global it does not error but does not return any choices. Here's the script that I used to call the script include

 

 

(function execute() {    
var nearbyStations = new ChargingStationLocator();
    nearbyStations.findNearbyStations(parseFloat(vaInputs.latitude),parseFloat(vaInputs.longitude),0.03);
    
var options = [];
for (var i = 0; i < nearbyStations.length; i++) {
   options.push({'value':nearbyStations[i].latitude+","+nearbyStations[i].longitude ,'label': nearbyStations[i].name});
}

    return options;
})()

 

 

0 REPLIES 0