AnsweredAssumed Answered

dynamic multi-select from API call

Question asked by Sergio Barrios on Oct 18, 2017
Latest reply on Oct 11, 2018 by Brad Foster



    what i'm trying to achieve here is to make an API call and use the retrieved values to generate a dynamic multi-select field and be able to save selected options. I have used HOWTO: Have a dropdown field that get's it's options from a function as a start point with no success. This is what i did:


1- created a new dropdown from dropdown editor named test_users_list to attach it to the multi-select field below. The reason i created this list was b/c when you create a multi-select field from studio it can't be empty and i didn't want to use any of the existing ones.


2- created a new multi-select field on campaigns (using dropdown list from step 1) that created the following file


3- inside that file it contained

// created: 2017-10-19 03:23:07

$dictionary['Campaign']['fields']['test_users_c']['labelValue']='test users';


4- proceeded to create the function as advised on the HOWTO and my file ended up like this

// created: 2017-10-19 03:23:07
function getUsers() {
$ch = curl_init('');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$userss = json_decode($result, true);

$userList = array();
foreach ($userss as $i => $userx) {

return $userList;
$dictionary['Campaign']['fields']['test_users_c']['labelValue']='test users';



Went to campaigns module, edited a campaign and the field is empty the array list wasn't created


empty multi-select


One thing that i noticed is that i didn't have 


to unset as advised on the HOWTO. I tried removing it with same results.



This HOWTO seems to be for an older version should still work for Ent 7.9.2, what could i be missing?


P.S. the API Call and the Array list do work i tested them separately this is how it looks the array list that should populate the multi-select

[] =>
[Bret] => Leanne Graham
[Antonette] => Ervin Howell
[Samantha] => Clementine Bauch
[Karianne] => Patricia Lebsack
[Kamren] => Chelsey Dietrich
[Leopoldo_Corkery] => Mrs. Dennis Schulist
[Elwyn.Skiles] => Kurtis Weissnat
[Maxime_Nienow] => Nicholas Runolfsdottir V
[Delphine] => Glenna Reichert
[Moriah.Stanton] => Clementina DuBuque


please advise