Open siddhant-mohan opened 8 years ago
I debugged it little more and found out that in gems/rubyzoho-0.5.0/lib/zoho_api_field_utils.rb:73
70: def create_and_add_field_value_pair(field_name, module_name, n, record)
71: debugger if module_name == "Invoices"
72: k = ApiUtils.string_to_symbol(field_name)
73: v = n.text == 'null' ? nil : n.text
74: r = record.merge({ k => v })
75: r = r.merge({ :id => v }) if primary_key?(module_name, k)
In create_and_add_field_value_pair method, its just assigning the n.text to v if its not null. But in my case n is
<FL val='Product Details'><product no='1'><FL val='Product Id'>1496038000000671051</FL><FL val='Product Name'><![CDATA[AWS Core Service]]></FL><FL val='Unit Price'>1.0</FL><FL val='Quantity'>22.0</FL><FL val='Quantity in Stock'>-269.0</FL><FL val='Total'>22.0</FL><FL val='Discount'>0.0</FL><FL val='Total After Discount'>22.0</FL><FL val='List Price'>1.0</FL><FL val='Net Total'>22.0</FL><FL val='Tax'>0.0</FL></product></FL>
which gives n.text = nil and thus product_details value comes out to be nil everytimes.
That’s very helpful. Did you want to send in a PR?
Yeah will send the PR in some time.
The same issue exists trying to get product_details from a Quote, which I just ran into.
PR was integrated. Can you point to the master branch and try it?
@amalc I tried on master and still not seeing Quote#product_detail records.
RubyZoho::Crm::Quote.first.product_details => nil
ZohoApi::Crm#related_records('Quotes', '{id}', 'Products') => 200
@jheth Hmm. OK. Let take a look.I had this problem on our instance a couple of year ago and fixed it but I don't think it was in the Gem. Something, if I remember correctly, with permissions.
I am making request to invoice api RubyZoho::Crm::Invoice.find_by_id('1496038000000856087')
I am getting all the data related to invoice but not the product_details.
I have checked the data of the direct api call to zoho crm and it's returning me product details also.