Solved

While overriding the GetBucketForImport method in BCSalesOrderProcessor graph getting error.

  • 15 February 2024
  • 1 reply
  • 26 views

Hi there, 

we have a customization where we have overridden the GetBucketForImport method in BCSalesOrderProcessor.cs graph. After overridden we are facing issue at await keyword.

Please refer the below screenshots and code.

Overridden code:

 public delegate Task<EntityStatus> GetBucketForImportDelegate(BCSalesOrderBucket bucket, BCSyncStatus syncstatus, CancellationToken cancellationToken);
[PXOverride]
public async Task<EntityStatus> GetBucketForImport(BCSalesOrderBucket bucket, BCSyncStatus syncstatus, CancellationToken cancellationToken, GetBucketForImportDelegate baseMethod)
{
OrderData data = await orderDataProvider.GetByID(syncstatus.ExternID);
if (data == null) return EntityStatus.None;

await Task.Yield();
data.OrderProducts = new List<OrdersProductData>();
await foreach (var item in orderProductsRestDataProvider.GetAll(syncstatus.ExternID, cancellationToken))
{

data.OrderProducts.Add(item);
}

MappedOrder obj = bucket.Order = bucket.Order.Set(data, data.Id?.ToString(), data.Id?.ToString(), data.DateModifiedUT.ToDate());

EntityStatus status = Base.EnsureStatus(obj, SyncDirection.Import);

if (status != EntityStatus.Pending && status != EntityStatus.Synchronized && Base.Operation.SyncMethod != SyncMode.Force)
return status;

return status;
}

Base code screenshot:

Thanks in advance.

icon

Best answer by simonliang91 15 February 2024, 19:09

View original

1 reply

Userlevel 5
Badge +1

I think you are working on the customization in 2024R1, the issue is the C# version in your project is 7.3, you have to change the project file and set to 8.0 or later version:

<PropertyGroup>

          <LangVersion>8.0</LangVersion>
</PropertyGroup>

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