Is there a way to get dropdown entries that appear in the "Dropdown Editor" via SOAP? For example, I want to get all the possible values for the lead source select field using soap.
Is there a way to get dropdown entries that appear in the "Dropdown Editor" via SOAP? For example, I want to get all the possible values for the lead source select field using soap.
anztenney,
I've sent in a patch to allow you to do that but it hasn't been accepted I guess.
This is what I had to do to get that to work:
Added the following code to soap/SoapPortalUsers.php (you may need to add it to soap/SoapSugarUsers.php and just call it get_dom_list): (The language is hard coded here but you could easily get the system default or if using SoapSugarUsers get the current user's language.)
And add to soap\SoapTypes.php:PHP Code:/** [IC] eggsurplus: be able to retrieve dom list values */
$server->register(
'portal_get_dom_list',
array('session'=>'xsd:string', 'dom_name'=>'xsd:string'),
array('return'=>'tns:get_dom_list_result'),
$NAMESPACE);
function portal_get_dom_list($session, $dom_name){
global $app_list_strings;
$app_list_strings = return_app_list_strings_language('en_us'); // <-- This needs to be dynamic
$error = new SoapError();
if(! portal_validate_authenticated($session)){
$error->set_error('invalid_session');
return array('dom_name'=>$dom_name, 'name_value_list'=>array(), 'error'=>$error->get_soap_array());
}
$options_dom = array();
$options_ret = array();
$options_dom = $app_list_strings[$dom_name]; //i.e. get 'case_status_dom'
if(!is_array($options_dom)) {
$error->set_error('no_dom_found');
return array('dom_name'=>$dom_name, 'name_value_list'=>array(), 'error'=>$error->get_soap_array());
}
foreach($options_dom as $key=>$oneOption) {
$options_ret[] = get_name_value($key,$oneOption);
}
return array('dom_name'=>$dom_name, 'name_value_list'=>$options_ret, 'error'=>$error->get_soap_array());
}
PHP Code:/** [IC] eggsurplus: to retrieve dom lists */
$server->wsdl->addComplexType(
'get_dom_list_result',
'complexType',
'struct',
'all',
'',
array(
'dom_name'=>array('name'=>'dom_name', 'type'=>'xsd:string'),
'name_value_list'=>array('name'=>'name_value_list', 'type'=>'tns:name_value_list'),
'error' => array('name' =>'error', 'type'=>'tns:error_value'),
)
);
/** END - [IC] */
I actually found a simpler way to get the dropdown values I wanted. If you want the values from the Dropdown Editor, then your code may be the correct thing, but here is what I did.
Code:$result = $soapclient->call('get_module_fields',array('session'=>$session,'module_name'=>'Prospects')); foreach($result['module_fields'] AS $key=>$value){ foreach($value['options'] AS $opNum=>$option){ $return[$option['name']] = $option['value']; } }
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks