Exporting field names and labels for a specific module

Hi there,

I was wondering if there is an easy way to export all fields and their display labels for a specific module ?

While Sugar uses the field names, a connected external application uses Sugar's labels as field names.

I'm trying to setup a link between the two...

Thanks for getting me in the right direction.

Bye now

Hugo

Parents Reply Children
  • I built a quick API that pulls all fields, the LBL and the corresponding name.
    Would that work for you?

    For example, for the Users module (minus my own custom fields), exporting the results to CSV:

    https://sugarclub.sugarcrm.com/cfs-file/__key/communityserver-discussions-components-files/54/modulelanguage.csv

    The code in case you want it (can be improved with Exceptions for non-existent modules, specific languages etc)

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?php
    require_once('include/api/SugarApi.php');
    class getModFieldsLangApi extends SugarApi
    {
    public function registerApiRest() {
    return array(
    'getModFieldsLang' => array(
    'reqType' => 'GET',
    'path' => array('getModFieldsLang', '?'),
    'pathVars' => array('','module'),
    'method' => 'getModFieldsLang',
    'shortHelp' => 'CustomWR: Given a module(required) get a list of fields and labels',
    'longHelp' => '',
    ),
    );
    }
    function getModFieldsLang($api, $args){
    $module = $args['module'];
    $res = array();
    $bean = BeanFactory::newBean($module);
    foreach ($bean->field_defs as $field => $value){
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX