Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not setting custom fields value on qbo #618

Closed
kashifcodility opened this issue Nov 20, 2024 · 1 comment
Closed

Not setting custom fields value on qbo #618

kashifcodility opened this issue Nov 20, 2024 · 1 comment

Comments

@kashifcodility
Copy link

kashifcodility commented Nov 20, 2024

Hi,

Here is my code to set qbo values on platform. it is setting project name properly but not setting "Location".

            custom_field = Quickbooks::Model::CustomField.new
            custom_field.name = "Project Name" 
            custom_field.string_value = order.project_name
            custom_field.id = '1'
            custom_field.type = "StringType"
            invoice.custom_fields << custom_field

  
           location = Quickbooks::Model::CustomField.new
           location.name = "Location"
           location.string_value = "Site (Refurnish)"
           location.id = '5'
           location.type = "StringType"
           invoice.custom_fields << location

i'm getting invoice using this code and set custom fields value "Location" there.

         service = Quickbooks::Service::Invoice.new
        service.access_token = your_access_token
        service.realm_id = your_realm_id
        invoice_id = '12345' # Replace with your invoice ID
        invoice = service.fetch_by_id(invoice_id)

this is not giving me "Location" custom field in this hash. i create it manually on qbo and set location properly too.

       #<Quickbooks::Model::Invoice global_tax_calculation: nil, id: 17177, sync_token: 0, meta_data: {"create_time"=>2024- 
        11-19 23:49:37 -0800, "last_updated_time"=>2024-11-19 23:49:37 -0800}, custom_fields: [# 
        <Quickbooks::Model::CustomField id: 1, name: Project Name, type: StringType, string_value: tomi goonnnn, 
        boolean_value: nil, date_value: nil, number_value: nil>], auto_doc_number: nil, doc_number: 165058, invoice_link: 
        https://connect.intuit.com/portal/app/CommerceNetwork/view/scs-v1- 
        4cec10eb15cd4e25a607c871a67524404a0b93b4d845453694ff6ec348286ca15c2067362c444378b3190f921f4dc1ff? 
        locale=en_US&cta=v3invoicelink, txn_date: 2024-11-20, currency_ref: {"name"=>"United States Dollar", 
        "value"=>"USD", "type"=>nil}, exchange_rate: nil, private_note: nil, linked_transactions: [], line_items: []>

Any help?

Thanks

@ruckus
Copy link
Owner

ruckus commented Jan 20, 2025

@kashifcodility The code looks correct. My first thought is that I have seen the word Location used in QBO and sometimes its called Department.

So perhaps it is basically a reserved word and QB is having issues a custom field with that exact Name.

Here is how I generally approach these issues:

  1. In the QBO web UI manually create an invoice with your desired properties. In your case put an obvious value in the "Location" field in the web UI
  2. Fetch that Invoice via the API
  3. Inspect it and see where your obvious place is in the payload.
  4. Now you can reverse engineer this process for generating an Invoice to send via the API

@ruckus ruckus closed this as completed Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants