chicks / sugarcrm

A ruby based REST Client for SugarCRM
MIT License
90 stars 64 forks source link

account_id is nil when listing contacts in sugarcrm 6.2 #51

Open openhealth opened 13 years ago

openhealth commented 13 years ago

Hi all, when getting a Contact, the account_id field is nil in sugarcrm 6.2. In 6.1 this worked fine. Here is my relevant code:

@sugar::Contact.all.each do |contact| puts contact: #{contact.inspect}" end

Here is some of the request:

get_entry_list: Request: { "session": "ltpn47ihvbgupo5ubfm9lb3qo5", "module_name": "Contacts", "query": "", "order_by": "date_entered", "offset": "", "select_fields": ["assigned_user_id","assistant_phone","phone_home","date_modified","alt_address_postalcode","accept_status_id","team_set_id","picture","description","email1","ti tle","primary_address_city","assigned_user_name","alt_address_state","reports_to_id","email2","report_to_name","primary_address_state","department","cec_bcse_c","assistant","sync_c ontact","email_and_name1","team_name","accept_status_name","phone_mobile","c_accept_status_fields","account_name","phone_other","alt_address_country","modified_by_name","last_name" ,"designer_c","alt_address_city","account_id","name","do_not_call","date_entered","team_count","m_accept_status_fields","birthdate","swh_installer_c","created_by_name","phone_fax", "alt_address_street_2","campaign_name","deleted","salutation","alt_address_street_3","primary_address_street_2","invalid_email","primary_address_street_3","email_opt_out","electric ian_c","modified_user_id","created_by","first_name","opportunity_role_fields","team_id","opportunity_role_id","opportunity_role","lead_source","full_name","primary_address_country","primary_address_street","primary_address_postalcode","alt_address_street","phone_work","id","campaign_id"], "link_name_to_fields_array": [], "max_results": "5", "deleted": 0 }

and now part of the response:

get_entry_list: JSON Response: {"entry_list"=> [{"name_value_list"=> {"primary_address_postalcode"=> {"name"=>"primary_address_postalcode", "value"=>""}, "primary_address_street"=> {"name"=>"primary_address_street", "value"=>""}, ... "salutation"=>{"name"=>"salutation", "value"=>""}, "account_id"=>{"name"=>"account_id", "value"=>""}, "report_to_name"=>{"name"=>"report_to_name", "value"=>""}, "date_modified"=> {"name"=>"date_modified", "value"=>"2011-04-14 04:49:31"},

When I do this manually without the gem, the account_id is returned correctly. Granted, this is the latest beta version of sugar but thought I would submit this report anyway because doing it without the gem using direct get_entry_list() call works as expected.

Thanks =)

chicks commented 13 years ago

Hrm, this is interesting... I just tested against SugarCRM 6.2 ce beta 4 and the account_id field was returned properly:

SugarCRM::Contact.first.account_id => "85fbc154-fc31-5a25-f777-4da26f5d9b2d" 

Can you give me your 6.2 build number and edition so I can pull it and test?

openhealth commented 13 years ago

Oh right that's strange. It's 6.2.0beta5 (Build 6296)

chicks commented 13 years ago

I can confirm this behavior in 6.2.0b5. Retrieving the record via get_entry("Contacts", id) returns a value for account_id. Retrieving the record via get_entry_list does not.

chicks commented 13 years ago

Additionally, this confirms this is a bug related to get_entry_list:

SugarCRM::Contact.find("9031b66d-8d6e-ee41-e3ef-4dc0d2744c9a").account_id
=> "f12a695c-eeb3-4362-d662-4dc0d2df48c5" 
chicks commented 13 years ago

I'm going to follow up with Roger, one of the Engineering Managers tomorrow to see if they want me to file a bug on this.

openhealth commented 13 years ago

Ah ok, I didn't test with a get_entry, only with get_entry_list. No worries, thanks for following up.