rubyzoho icon indicating copy to clipboard operation
rubyzoho copied to clipboard

API doesn't save custom fields or non string fields

Open pjsim opened this issue 11 years ago • 6 comments

Ok got another one. This one has me stumped.. it seems that if I have a custom attribute or an attribute that isn't text, it will not get saved into zoho if I save those fields using the API.

For instance doing.. irb(main):016:0> my_lead = RubyZoho::Crm::Lead.new( irb(main):017:1* :first_name => 'Tom', irb(main):018:1* :last_name => 'Thompson', irb(main):019:1* :email => '[email protected]', irb(main):020:1* :phone => '12345', irb(main):021:1* :no_of_employees => 40, irb(main):022:1* :pdf_2_requested => "true" irb(main):023:1> )

irb(main):024:0> my_lead.save

This will create a Lead with the first name, last name, email and phone field all working. But the number field and the custom field are empty.

pjsim avatar Feb 03 '14 01:02 pjsim

Ah I just figured out the custom field issue. The gem converts the symbol to "Pdf 2 Requested" whereas the actual field was "PDF 2 Requested" so I just had to name that properly.

pjsim avatar Feb 03 '14 01:02 pjsim

Shoot, that's a nasty one. I've got some work in-flight on the gem to manage a mapping of Zoho fields to internal fields so this kind of stuff goes away. Because the problem also happens with special characters in field names. It would have been nice if display in Zoho was different from the name sent across, but somebody has to map it regardless.

There is an attr_writers method that will dump what the internal representation is of a Zoho field.

I'll push out a new version of the gem with your PR in it tomorrow.

amalc avatar Feb 03 '14 01:02 amalc

Are you still having problems with a pure number field? Did the field get retrieved when the API initialized?

amalc avatar Feb 03 '14 01:02 amalc

Still not working. It's not a major issue for me at the moment but might need to be fixed eventually.

pjsim avatar Feb 05 '14 06:02 pjsim

@pjsim Took a run at non-text fields and the Zoho API is rejecting anything that isn't text. Currency etc. I've asked them what their preferred format is, so we'll see.

amalc avatar Feb 22 '15 23:02 amalc

Updates to integer custom fields appear to be working. There is a test that passes now. However, it does return a string when queried.

amalc avatar Feb 25 '15 18:02 amalc