Acumatica CustomFields not working on sales order

2019-09-15 11:27发布

I'm working on an Acumatica integration through ASP.net that creates Sales Orders in Acumatica via the contract based API. I am using version 5.30. There are certain fields that come standard on the Acumatica objects, and some that don't. For those that don't exist, I was shown a way here using the CustomFields property that you can add data to these fields when a sales order is created. This worked great for the SalesOrder object, however, when I tried this on the Contact object, it does not work. I am trying to update the "Attention" field on the shipping settings tab of a SalesOrder. You can see in the image below that this field maps to the "Salutation" data field.

enter image description here

I try to update this field via the CustomFields property but it does not work:

orderToBeCreated = new SalesOrder
{
    OrderType = new StringValue { Value = "SO" },
    CustomerID = new StringValue { Value = customerID },
    Description = new StringValue { Value = orderDescription },
    CustomerOrder = new StringValue { Value = order.order_number.ToString() },
    ExternalReference = new StringValue { Value = externalReference },
    Details = orderDetails.ToArray<SalesOrderDetail>(),
    ShippingAddressOverride = new BooleanValue { Value = true },
    ShippingContactOverride = new BooleanValue { Value = true },
    ShippingContact = new Contact()
    {
        DisplayName = new StringValue { Value = order.shipping_address.company },
        FirstName = new StringValue { Value = order.shipping_address.first_name },
        LastName = new StringValue { Value = order.shipping_address.last_name },
        Email = new StringValue { Value = order.customer.email },
        Phone1 = new StringValue {
            Value = (order.billing_address.phone.Length > 0) ? order.billing_address.phone : "-"
        },
        Address = new Address()
        {
            AddressLine1 = new StringValue { Value = order.shipping_address.address_1 },
            AddressLine2 = new StringValue { Value = order.shipping_address.address_2 },
            City = new StringValue { Value = order.shipping_address.city },
            State = new StringValue { Value = order.shipping_address.state },
            Country = new StringValue { Value = order.shipping_address.country },
            PostalCode = new StringValue { Value = order.shipping_address.postcode }
        },
        CustomFields = new CustomField[]
        {
            new CustomStringField
            {
                Name = "Salutation",
                Value = new StringValue { Value = order.shipping_address.first_name + " " + order.shipping_address.last_name },

            }
        }
    },
    ShipVia = new StringValue { Value = _shipViaOptions[order.shipping_methods] },
    CustomFields = new CustomField[]
    {
            new CustomStringField
            {
                Name = "ShipTermsID",
                Value = new StringValue { Value = _shipTermsOptions[order.shipping_methods] }
            }
    }
};

Why would this work for ShippingTermsID and not for Salutation?

标签: acumatica
1条回答
在下西门庆
2楼-- · 2019-09-15 12:03

In the post you link for where you saw this work, here. it is mentioned that this way of doing things work for Acumatica Version 6.00 and higher, while you are on version 5.30.

Though Luck is on your side, the field you are trying to update is in the default endpoint though it was name differently. Its name is "Position".

enter image description here

查看更多
登录 后发表回答