Skip to main content
Solved

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


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"}}

Best answer by Dmitrii Naumov

Hello @deepthivenkatesan 

What version of the RESTClient  do you have?

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

 

View original
Did this topic help you find an answer to your question?

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings