Get labels of all the fields available for a module

Hello,

I have a requirement where I need to get the list of all fields available for a module. I am currently using this endpoint to get the data:

/rest/v11/metadata?type_filter=modules&module_filter=Contacts

Everything is working fine with this except the label. The response doesn't have anything that can be shown as a label for the user on our side.

'First Name' instead of 'first_name'.

Is there anything that can be done for this?

I have attached the response format I am getting.

Parents Reply Children
  • As the Sugar application with versions less than 7.0 did not need the labels in the browser there was no web service call to load them, all language translation was made on the server. So API v1-v4_1 do not contain calls which deliver any lull language sets.

    But the V2-V4_1 SOAP/REST call get_module_fields returns the list of all fields of a given module and in the list of fields you find the label of each field.  

        $setParams = array(
    		'session' => $session_id,
    		'module_name' => 'Contacts',
    		'fields' => '',
    	);
    	$result = call('get_module_fields',$setParams,$url);
    

    returns the list of all fields in module Contacts, which looks like this:

    stdClass Object
    (
        [module_name] => Contacts
        [module_fields] => stdClass Object
            (
                [id] => stdClass Object
                    (
                        [name] => id
                        [type] => id
                        [label] => ID:
                        [required] => 1
                        [options] => Array
                            (
                            )
    
                    )
    
                [name] => stdClass Object
                    (
                        [name] => name
                        [type] => fullname
                        [label] => Name:
                        [required] => 0
                        [options] => Array
                            (
                            )
    
                    )
    
    and so on

    So the value of the label for the field "name" can be found in $result->module_fields->name->label

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH