{"action":"created","issue":{"url":"https://api.github.com/repos/ruckus/quickbooks-ruby/issues/219","labels_url":"https://api.github.com/repos/ruckus/quickbooks-ruby/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/ruckus/quickbooks-ruby/issues/219/comments","events_url":"https://api.github.com/repos/ruckus/quickbooks-ruby/issues/219/events","html_url":"https://github.com/ruckus/quickbooks-ruby/issues/219","id":56685869,"number":219,"title":"custom field value not saving in qb","user":{"login":"zeeshananis","id":10771981,"avatar_url":"https://avatars.githubusercontent.com/u/10771981?v=3","gravatar_id":"","url":"https://api.github.com/users/zeeshananis","html_url":"https://github.com/zeeshananis","followers_url":"https://api.github.com/users/zeeshananis/followers","following_url":"https://api.github.com/users/zeeshananis/following{/other_user}","gists_url":"https://api.github.com/users/zeeshananis/gists{/gist_id}","starred_url":"https://api.github.com/users/zeeshananis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeeshananis/subscriptions","organizations_url":"https://api.github.com/users/zeeshananis/orgs","repos_url":"https://api.github.com/users/zeeshananis/repos","events_url":"https://api.github.com/users/zeeshananis/events{/privacy}","received_events_url":"https://api.github.com/users/zeeshananis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-05T15:38:27Z","updated_at":"2015-02-10T15:31:42Z","closed_at":null,"body":"I am creating and saving custom field in invoice using the below code:\r\n\r\ncustom_field = Quickbooks::Model::CustomField.new\r\n              custom_field.name = \"LFI Invoice #\"\r\n              custom_field.type = \"StringType\"\r\n              custom_field.string_value = \"LFI12345678\"\r\n              invoice = Quickbooks::Model::Invoice.new\r\n              invoice.custom_fields = [custom_field]\r\n\r\nso before saving the invoice object json is as below while debugging:\r\n\r\n{\"line_items\":[{\"amount\":\"5.99\",\"description\":\"Plush Baby Doll\",\"detail_type\":\"SalesItemLineDetail\",\"sales_line_item_detail\":\r\n\r\n{\"unit_price\":\"5.99\",\"quantity\":1,\"item_ref\":{\"value\":\"36\"}}}],\"custom_fields\":[{\"name\":\"LFI Invoice \r\n\r\n#\",\"type\":\"StringType\",\"string_value\":\"LFI123456\"}],\"customer_ref\":{\"value\":\"95\"},\"txn_date\":\"2015-02-05\",\"doc_number\":\"\"}\r\n\r\nbut after invoice creation it gives me empty custom field,when i query invoice in API explorer, it gives me below json of custom field part:\r\n\r\n\"CustomField\": [\r\n          {\r\n            \"DefinitionId\": \"1\",\r\n            \"Name\": \"LFI Invoice #\",\r\n           \"Type\": \"StringType\"\r\n          }\r\n        ],\r\n\r\nAny suggestion what's the issue\r\n"},"comment":{"url":"https://api.github.com/repos/ruckus/quickbooks-ruby/issues/comments/73719136","html_url":"https://github.com/ruckus/quickbooks-ruby/issues/219#issuecomment-73719136","issue_url":"https://api.github.com/repos/ruckus/quickbooks-ruby/issues/219","id":73719136,"user":{"login":"minimul","id":199862,"avatar_url":"https://avatars.githubusercontent.com/u/199862?v=3","gravatar_id":"","url":"https://api.github.com/users/minimul","html_url":"https://github.com/minimul","followers_url":"https://api.github.com/users/minimul/followers","following_url":"https://api.github.com/users/minimul/following{/other_user}","gists_url":"https://api.github.com/users/minimul/gists{/gist_id}","starred_url":"https://api.github.com/users/minimul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minimul/subscriptions","organizations_url":"https://api.github.com/users/minimul/orgs","repos_url":"https://api.github.com/users/minimul/repos","events_url":"https://api.github.com/users/minimul/events{/privacy}","received_events_url":"https://api.github.com/users/minimul/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T15:31:42Z","updated_at":"2015-02-10T15:31:42Z","body":"You can't add a new custom field via the API. It must be done on QBO Company Preferences.\r\nSee attached.\r\n![screen shot 2015-02-10 at 10 23 56 am](https://cloud.githubusercontent.com/assets/199862/6129829/21d64526-b10f-11e4-87cc-5539db1f8699.png)\r\n\r\nYou would need to add 'LFI Invoice #' in there. After that you would need to set the Definition Id, which would be 2\r\n```\r\ncustom_field.id = 2\r\n```"}}