amalc / rubyzoho

Abstracting Zoho’s API into a set of Ruby classes, with reflection of Zoho’s fields using a more familiar ActiveRecord lifecycle, but without ActiveRecord. Works with Rails and Devise.
MIT License
62 stars 57 forks source link

Unable to add number of employees #60

Closed ryujignh closed 8 years ago

ryujignh commented 8 years ago

I've been trying to make a new lead with the number of employees. It successfully populates other fields, but only the number of employees field isn't populated. Here is my code. Am I missing something?

l = RubyZoho::Crm::Lead.new(:first_name => 'firstname', :last_name => 'lastname', :email => 'email@com', :phone => '123-4567-8910', :company => 'company', :title => 'title', :no_of_employees => 100, :lead_source => 'Web site') 

l.save

<RubyZoho::Crm::Lead:0x007fe4d4424f30 @fields=[:first_name, :last_name, :email, :phone, :company, :title, :no_of_employees, :lead_source], @module_name="Leads", @id="2080032000000118005", @company="company", @first_name="firstname", @last_name="lastname", @email="email@com", @phone="123-4567-8910", @lead_source="Web site", @no_of_employees=100, @created_by="Me", @modified_by="Me", @created_time="2016-09-26 19:23:23", @modified_time="2016-09-26 19:23:23", @title="title">

l = RubyZoho::Crm::Lead.find_by_email('email@com')
l.first.no_of_employees => "0"

Thank you,

amalc commented 8 years ago

Looks good to me. Do you have the field defined in Zoho? Sorry, obvious question. And does the API user have the rights to update it?

ryujignh commented 8 years ago

Yes, I have the field number of employees in the lead information. Do you individually have to set the permission to update for each field in Zoho?

ryujignh commented 8 years ago

The field name has a dot in it (No. of Employees). Does it might cause any trouble populating data?

ryujignh commented 8 years ago

I have found the cause and solution. Just created a new PR. Thanks!

amalc commented 8 years ago

Yes, that's the problem. Can you try pointing to the master branch? We have a mapping fix in there.