create custom field in sugarcrm database and get that value using REST

Hi

I just created a custom field in in database(in user table, i don't know it is good way or not), now i want to get the custom field value using REST api,all value are retrieving except my custom field. Below is my rest api params

$get_entries_parameters = array(

         'session' => $session_id,

         'module_name' => 'Users',

         'ids' => array('1'),

         'select_fields' => array(

            'user_name',

            'first_name',

            'reports_to_id',

          'mycustomfield',

         ),

         'link_name_to_fields_array' => array(),

        );

    $get_entries_result = call("get_entries", $get_entries_parameters, $url);

all value are return except my customfield how i get this.

Parents
  • Aravinth,

    Since this field was created directly in the database, it is possible that there are missing components that are required by Sugar.  When a field is created via Studio, a vardef file is created on the file system, along with the field being created in the [module]_cstm table and fields_meta_data table within the database.

    If you create the field via Studio, the REST call should return results.

    For reference, here is a link to developer guide that walks you through manually creating a field.

    You can also review this document on creating fields in Studio.

    Hope this helps,

    Lori

  • Hi Aravinth..

    Try this

    $get_entry_parameters = array(

         'session' => $session_id,

         'module_name' => "Users",

         'id' => "XXXX",

         'select_fields' => array(

              'my_custom_field_c',

         ),

        );

        $get_entry_result = call("get_entry", $get_entry_parameters, $url);

        $pre_msg = $get_entry_result->entry_list[0]->name_value_list->my_custom_field_c->value;

    my_custom_field_c

Reply
  • Hi Aravinth..

    Try this

    $get_entry_parameters = array(

         'session' => $session_id,

         'module_name' => "Users",

         'id' => "XXXX",

         'select_fields' => array(

              'my_custom_field_c',

         ),

        );

        $get_entry_result = call("get_entry", $get_entry_parameters, $url);

        $pre_msg = $get_entry_result->entry_list[0]->name_value_list->my_custom_field_c->value;

    my_custom_field_c

Children