Solved

Update an attribute based User Defined Field using Acumatica.RESTClient.ContractBasedApi

  • 19 March 2024
  • 3 replies
  • 61 views

I'm using the Acumatica RESTClient and Acumatica Default_22.200.001 libraries in building an API interface. I'm connecting to the Default endpoint. The Purchase Order screen has a User Defined Field based off an Attribute.

I am able to create the PO however the UDF field is not updated. The Custom field in the generated JSON request is only showing the Type but not the Value of the attribute. Below are some code snippets:

public class CustomStringField : Acumatica.RESTClient.ContractBasedApi.Model.CustomField
{
public string Value { get; set; }
}
Acumatica.RESTClient.ContractBasedApi.Model.CustomStringField customStringField = new Acumatica.RESTClient.ContractBasedApi.Model.CustomStringField()
{
viewName = "Document",
fieldName = "AttributeESTPONBR",
Type = "CustomStringField",
Value = "E123"
};
PurchaseOrder order = new PurchaseOrder()
{
Type = "Normal",
Date = poDate,
PromisedOn = estDelDate,
VendorID = vendor.VendorID,
VendorRef = vQuote,
Description = notes,
Note = splInstr,
Custom = new Dictionary<string, Dictionary<string, Acumatica.RESTClient.ContractBasedApi.Model.CustomField>>
{
{
"Document", new Dictionary<string, Acumatica.RESTClient.ContractBasedApi.Model.CustomField>
{
{"AttributeESTPONBR", customStringField }
}
}

},
Details = details
};

Yet, my generated JSON request does not show the value for the attribute. What am I doing incorrect? Or is it not possible to update a custom UDF via API without extending the endpoint? Appreciate any help.

Body: {"Date":{"value":"2024-03-15T00:00:00"},"Description":{"value":"test"},"Details":[{"InventoryID":{"value":"ARCHITECTURAL DOORS"},"OrderQty":{"value":10.0},"UnitCost":{"value":325.0},"UOM":{"value":"EACH"}}],"PromisedOn":{"value":"2024-03-15T00:00:00"},"Type":{"value":"Normal"},"VendorID":{"value":"DOUMOC"},"VendorRef":{"value":"r456"},"custom":{"Document":{"AttributeESTPONBR":{"Type":"CustomStringField"}}},"note":{"value":"test"}}

icon

Best answer by Dmitrii Naumov 20 March 2024, 15:25

View original

3 replies

Userlevel 7
Badge +5

Hello @deepthivenkatesan 

What version of the RESTClient  do you have?

I’ve checked the code in 5.1 and it seems to work fine

 

Hi Dmitrii,

Thank you, I’m using Acumatica.RESTClient version 4.1.1.

Do not see a version 5.1 in NuGet Package Manager.

Thanks @Dmitrii Naumov , found version 5.1 as pre-release and that works without any issues.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved