Skip to main content

How-TO: Import Sales Order Lines custom field with Commerce Connector

  • 9 October 2020
  • 1 reply
  • 576 views

smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • 227 replies

Acumatica Commerce Connector does not allow mapping of the custom fields for the Sales Order Lines using Entity mapping screen, however, you can use customization engine and include custom fields.

To do so, you can create an extension for the Sales Order Processor and include the SO Line custom fields in the API Object.

//BCSalesOrderProcessor is the main class that does synchronization of the Sales Orders
public class BCSalesOrderProcessorExt : PXGraphExtension<BCSalesOrderProcessor>
{
    public delegate void MapBucketImportDelegate(BCSalesOrderBucket bucket, IMappedEntity existing);

    //MapBucketImport is mapping the eCommerce API object to Acumatica API Object.
    [PXOverride]
    public void MapBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing, MapBucketImportDelegate baseMethod)
    {
        baseMethod(bucket, existing);

        foreach (var detrow in (IEnumerable<SalesOrderDetail>)bucket.Order.Local.Details)
        {
            detrow.Custom = new CustomField[]
            {
               new CustomStringField()
               {
                    ViewName = "Transactions", //Dataview name for the sales order details
                    FieldName = "UsrField", //Custom field name
                    Value = "Test1" // Custom field value
               }
            }.ToList();
        }
    }
}

Hope it helps!

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

1 reply

  • Freshman I
  • 10 replies
  • September 28, 2021

Is it possible to do this in Shopify as well?


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