Skip to main content
Question

How to access sales order line note field from BCSalesOrderProcessor extension


lauraj46
Captain II
Forum|alt.badge.img+8

We have extended BCSalesOrderProcessor to loop through the Big Commerce modifiers for a line item and append the description to the SOLine description field.  It works well, but the problem is that if there are many modifiers the data exceeds the LineDescription field length of 255 characters and is truncated.

Current code:

  public class BCSalesOrderProcessor_Extension : PXGraphExtension<PX.Commerce.BigCommerce.BCSalesOrderProcessor>
  {
    ….

              detail.LineDescription.Value = detail.LineDescription.Value + "\r\n" + GetModifiers(data); 

}

GetModifiers is a function that retrieves the list of modifiers and values for the line.

Options under consideration are:

  1. Write the description to the sales order line note (looking for syntax to do that) 
  2. Create a custom field on SOLine with more characters  OR
  3. Increase the field size of LineDescription on SOLine

Thoughts or recommendations?  If someone can help with the syntax to populate the note from BCSalesOrderProcessor extension that would be awesome too.

Thanks in advance!

Laura

 

3 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3

Hi ​@lauraj46,

Here is the syntax for reading and writing notes:

// Get the note
var note = PXNoteAttribute.GetNote(SOLineCache, soLineRow);

// Set the note
PXNoteAttribute.SetNote(SOLineCache, soLineRow, note);

 


lauraj46
Captain II
Forum|alt.badge.img+8
  • Author
  • Captain II
  • 577 replies
  • March 21, 2025

Hi ​@Zoltan Febert ,

Thanks for the response!  I don't think we have SOLineCache in the context of the BCSalesOrderProcessor.  See sample code below:

public class BCSalesOrderProcessorExt : PXGraphExtension<BCSalesOrderProcessor>

  {

    public delegate void SaveBucketImportDelegate(BCSalesOrderBucket bucket, IMappedEntity existing, String operation);

 

    [PXOverride]

    public virtual void SaveBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing, String operation, SaveBucketImportDelegate baseMethod)

    {

      MappedOrder order = bucket.Order; //Object of the sales order

 

      //Extern is the API Object from BigCommerce

      for (int i = 0; i < (order.Extern.OrderProducts?.Count ?? 0); i++) 

      {

        OrdersProductData data = order.Extern.OrderProducts[i];

        //Local is the API Object from Acumatica

        SalesOrderDetail detail = order.Local.Details.Where(x => x.Delete != true).Skip(i).Take(1).FirstOrDefault(); 

Thanks,

Laura 


Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+5
lauraj46 wrote:

Hi ​@Zoltan Febert ,

Thanks for the response!  I don't think we have SOLineCache in the context of the BCSalesOrderProcessor.  See sample code below:

public class BCSalesOrderProcessorExt : PXGraphExtension<BCSalesOrderProcessor>

  {

    public delegate void SaveBucketImportDelegate(BCSalesOrderBucket bucket, IMappedEntity existing, String operation);

 

    [PXOverride]

    public virtual void SaveBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing, String operation, SaveBucketImportDelegate baseMethod)

    {

      MappedOrder order = bucket.Order; //Object of the sales order

 

      //Extern is the API Object from BigCommerce

      for (int i = 0; i < (order.Extern.OrderProducts?.Count ?? 0); i++) 

      {

        OrdersProductData data = order.Extern.OrderProducts[i];

        //Local is the API Object from Acumatica

        SalesOrderDetail detail = order.Local.Details.Where(x => x.Delete != true).Skip(i).Take(1).FirstOrDefault(); 

Thanks,

Laura 

Both SalesOrder and SalesOrderDetail classes contain Note property.

I would suggest overriding the MapBucketImport method instead of SaveBucketImport, prepare the string of modifiers per each line and then simply map it to the Sales Order Detail record. Details[i] and “text” below are just for example

bucket.Order.Local.Details[i].Note = "text";

You can find the line you need based on the ExternalRef and productData.Id as Acumatica is using that for maintaining the link

salesOrderDetail.ExternalRef = productData.Id.ToString().ValueField();

 


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