Ubaidullah
Ubaidullah

Reputation: 33

Acumatica: JSON to Update User Defined Field Value in SalesInvoice

Is there any way to dynamically populate user-defined field value in SalesInvoice. I'm using REST API, and I need JSON example to add value to field.

I'm using this to update the field.

screenshot

{
  "Attributes": [
    {
      "AttributeID": {
        "value": "testattributeid"
      },
      "Required": {
        "value": false
      },
      "Value": {
        "value": "testvalue"
      }
    }
  ]
}

Upvotes: 1

Views: 825

Answers (2)

Dmitrii Naumov
Dmitrii Naumov

Reputation: 1712

Please check the following help article: https://help-2020r1.acumatica.com/(W(27))/Help?ScreenId=ShowWiki&pageid=c5e2f36a-0971-4b33-b127-3c3fe14106ff

You can retrieve User Defined Fields using $custom parameter like that: GET: {{sitename}}/entity/Default/18.200.001/SalesOrder?$custom=Document.AttributeCOLOR

As for updating the record, please check this article: https://help-2020r1.acumatica.com/(W(27))/Help?ScreenId=ShowWiki&pageid=7b104d41-3457-42f8-8010-165d9d931d3f

You can update the custom field in the record like that:

PUT: {{sitename}}/entity/Default/18.200.001/SalesOrder
BODY:
{       
    "Description": {
        "value": "TEST"
    },
    "OrderNbr": {
        "value": "SO005435"
    },
    "OrderType": {
        "value": "SO"
    },
    "custom": {
        "Document": {
            "AttributeCOLOR": {
                "type": "CustomStringField",
                "value": "BLACK"
            }
        }
    }
}

Upvotes: 2

Chris H
Chris H

Reputation: 765

The user-defined fields are stored in tables suffixed by "KvExt". Unfortunately those tables are not defined via DACs. I did not find a way to extend the endpoint, in order to include the user-defined fields.

One option: create a DAC which maps to the table SOOrderKvExt. Then add a dataview to the SOOrder entry graph which returns the fields. The PK link between the two DACs are RecordID. After you add the view in the graph, you could extend the endpoint to include the fields (ValueNumeric, ValueDate, ValueString, ect). Those fields are the user-defined fields. After you extend the endpoint, you can update your user-defind fields via REST.

Upvotes: -1

Related Questions