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

  • 9 October 2020
  • 1 reply
  • 427 views

Userlevel 6
Badge +3
  • Acumatica Commerce Edition Team Lead
  • 208 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!


1 reply

Is it possible to do this in Shopify as well?

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 — 2022  Acumatica, Inc. All rights reserved