我使用以下代码在发票中创建并保存自定义字段:
custom_field = Quickbooks::Model::CustomField.new
custom_field.name = "LFI Invoice #"
custom_field.type = "StringType"
custom_field.string_value = "LFI12345678"
invoice = Quickbooks::Model::Invoice.new
invoice.custom_fields = [custom_field]
所以在保存发票对象之前,json在调试时如下所示:
{
"line_items": [
{
"amount": "5.99",
"description": "Plush Baby Doll",
"detail_type": "SalesItemLineDetail",
"sales_line_item_detail": {
"unit_price": "5.99",
"quantity": 1,
"item_ref": {
"value": "36"
}
}
}
],
"custom_fields": [
{
"name": "LFI Invoice #",
"type": "StringType",
"string_value": "LFI123456"
}
],
"customer_ref": {
"value": "95"
},
"txn_date": "2015-02-05",
"doc_number": ""
}
但是在创建发票后它给了我空的自定义字段,当我在API资源管理器中查询发票时,它给出了我自定义字段部分的json:
"CustomField": [
{
"DefinitionId": "1",
"Name": "LFI Invoice #",
"Type": "StringType"
}
],
有任何建议
的问题答案 0 :(得分:0)
根据文件:
您必须指定这些字段才能设置自定义字段值:
您没有指定definition_id
字段。