sugarcrm icon indicating copy to clipboard operation
sugarcrm copied to clipboard

Custom fields not returned in 6.1.1 with get_relationships

Open davidsulc opened this issue 15 years ago • 12 comments

(Edit: filed as SugarCRM bug 43342)

To reproduce:

  1. Add a custom field case_number_c to opportunity (via Studio)
  2. Link an opportunity to customer (make sure opportunity has a value in case_number_c field)
  3. Retrieve customer c with gem
  4. Inspect c.opportunities.first.case_number_c

If the same opportunity is retrieved directly, the field is returned properly (with the corresponding value).

It seems the issue comes from get_relationships: the case_number_c field isn't included in the response. (As I recall, it was properly returned in 5.5).

Chicks, can you confirm?

(This bug will have to be filed with SugarCRM, I wanted to confirm first.)

davidsulc avatar Apr 10 '11 21:04 davidsulc

Confirmed this is an issue in 6.1.4:

get_relationships doesn't return custom fields even when you ask for them specifically. I added a custom field (pet_name_c) to the Accounts module, then asked for that field via get_relationships...

get_relationships: Request:
{
  "session": "3a236a4d73824a27b6b2f78301ff0a04",
  "module_name": "Contacts",
  "module_id": "2f470762-3bf9-3583-0613-4da250c06ab4",
  "link_field_name": "accounts",
  "related_module_query": "",
  "related_fields": ["shipping_address_street_4","rating","phone_alternate","name","invalid_email","email_opt_out","shipping_address_state","phone_fax","campaign_id","ticker_symbol","phone_office","parent_name","date_modified","billing_address_state","billing_address_city","modified_user_id","id","email1","deleted","created_by","billing_address_street_2","account_type","shipping_address_country","ownership","created_by_name","campaign_name","billing_address_street_3","website","parent_id","modified_by_name","employees","billing_address_street_4","assigned_user_name","description","date_entered","assigned_user_id","annual_revenue","sic_code","shipping_address_street_2","shipping_address_street","shipping_address_postalcode","shipping_address_city","billing_address_street","billing_address_postalcode","billing_address_country","shipping_address_street_3","pet_name_c","industry"],
  "related_module_link_name_to_fields_array": [],
  "deleted": 0
}

get_relationships: JSON Response:
{"entry_list"=>
  [{"name_value_list"=>
     {"name"=>{"name"=>"name", "value"=>"King Software Inc"},
      "shipping_address_state"=>
       {"name"=>"shipping_address_state", "value"=>"CA"},
      "billing_address_city"=>
       {"name"=>"billing_address_city", "value"=>"Cupertino"},
      "billing_address_state"=>
       {"name"=>"billing_address_state", "value"=>"CA"},
      "date_modified"=>
       {"name"=>"date_modified", "value"=>"2011-04-11 00:56:50"},
      "phone_office"=>{"name"=>"phone_office", "value"=>"(464) 165-2225"},
      "account_type"=>{"name"=>"account_type", "value"=>"Customer"},
      "created_by"=>{"name"=>"created_by", "value"=>"1"},
      "deleted"=>{"name"=>"deleted", "value"=>"0"},
      "id"=>{"name"=>"id", "value"=>"20076df3-ac96-22bd-4014-4da250310c76"},
      "modified_user_id"=>{"name"=>"modified_user_id", "value"=>"1"},
      "shipping_address_country"=>
       {"name"=>"shipping_address_country", "value"=>"USA"},
      "created_by_name"=>
       {"name"=>"created_by_name", "value"=>"Charles Administrator"},
      "website"=>{"name"=>"website", "value"=>"www.qakid.biz"},
      "modified_by_name"=>
       {"name"=>"modified_by_name", "value"=>"Charles Administrator"},
      "assigned_user_name"=>
       {"name"=>"assigned_user_name", "value"=>"Sally Bronsen"},
      "assigned_user_id"=>
       {"name"=>"assigned_user_id", "value"=>"seed_sally_id"},
      "date_entered"=>{"name"=>"date_entered", "value"=>"2011-04-11 00:51:54"},
      "billing_address_country"=>
       {"name"=>"billing_address_country", "value"=>"USA"},
      "billing_address_postalcode"=>
       {"name"=>"billing_address_postalcode", "value"=>"70840"},
      "billing_address_street"=>
       {"name"=>"billing_address_street", "value"=>"48920 San Carlos Ave"},
      "shipping_address_city"=>
       {"name"=>"shipping_address_city", "value"=>"Cupertino"},
      "shipping_address_postalcode"=>
       {"name"=>"shipping_address_postalcode", "value"=>"70840"},
      "shipping_address_street"=>
       {"name"=>"shipping_address_street", "value"=>"48920 San Carlos Ave"},
      "industry"=>{"name"=>"industry", "value"=>"Chemicals"}},
    "id"=>"20076df3-ac96-22bd-4014-4da250310c76",
    "module_name"=>"Accounts"}],
 "relationship_list"=>[]}

chicks avatar Apr 11 '11 01:04 chicks

I'll have to check at work where I have 5.5 installed, but I'm pretty sure it returns custom fields.

davidsulc avatar Apr 11 '11 01:04 davidsulc

Are you running 5.5.0 or 5.5.1? I can try it as well.

chicks avatar Apr 11 '11 03:04 chicks

I can't recall. I'll have to check tomorrow...

davidsulc avatar Apr 11 '11 04:04 davidsulc

Filed bug 43342 for this one.

chicks avatar Apr 11 '11 04:04 chicks

I can confirm that this is a regression: it works correctly on 5.5.1RC2 (Build 1175)

Git bisect for the win !

davidsulc avatar Apr 11 '11 13:04 davidsulc

Hah, awesome... I'll update the bug.

chicks avatar Apr 11 '11 14:04 chicks

I have submitted a case to sugar for them to fix this. We are a gold partner so they are going to take a look at this for us on Tuesday (US time). Will let you know when it's fixed.

openhealth avatar May 16 '11 21:05 openhealth

Neat. Can you let them know that SugarCRM bug 43342 is probably a duplicate (meaning they can close it at the same time) ?

davidsulc avatar May 17 '11 13:05 davidsulc

Hi, I just thought I'd let you know that I've finally got a work around for this, until the sugar devs fix it.

In data/SugarBean.php at around line 3037, the following line exists: $custom_join = $this->custom_fields->getJOIN( empty($filter)? true: $filter );

In sugar 5.5, the line is: $custom_join = $this->custom_fields->getJOIN( true );

So if you change it to the same line as 5.5 then custom fields will be returned once again.

openhealth avatar Jul 11 '11 01:07 openhealth

If your bug isn't fixed, you can probably submit this as a pull request to SugarCRM CE!

chicks avatar Jul 11 '11 03:07 chicks

Ahh OK. I don't think they're interested though, it was one of the sugar officials who got back to me about this, so they know about it. Will assume that the devs will fix it, at least that's the impression I got.

openhealth avatar Jul 11 '11 04:07 openhealth