Skip to main content
Answer

While overriding the GetBucketForImport method in BCSalesOrderProcessor graph getting error.

  • February 15, 2024
  • 1 reply
  • 55 views

Forum|alt.badge.img

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.

Best answer by simonliang91

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>

1 reply

simonliang91
Acumatica Employee
Forum|alt.badge.img+1
  • Acumatica Employee
  • Answer
  • February 15, 2024

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>