microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
768 stars 611 forks source link

[Bug]: Shopify: Unneccesary call to DoMapping function resulting in uncalled Event Publisher #26515

Open JeppeBylov opened 3 months ago

JeppeBylov commented 3 months ago

Describe the issue

When shopify imports orders, the event publisher OnBeforeProcessSalesDocuments is never triggered unless all lines are mapped to items. This is because the report 30104 "Shpfy Sync Orders from Shopify" calls the "DoMapping" function before calling the CreateSalesDocumentForOrders(OrderHeader);

This is a problem for my client, becuase we have a customization that will handle mapping depending on attributes. The customization subscribes to the OnBeforeProcessSalesDocuments publisher.

https://github.com/microsoft/ALAppExtensions/blob/18455700ada751a86886a8cefdb071bd4a76ce71/Apps/W1/Shopify/app/src/Order%20handling/Reports/ShpfySyncOrdersfromShopify.Report.al#L65-L67

Expected behavior

There should be no call to the DoMapping function, as this is already a part of the process of creating sales documents.

Steps to reproduce

  1. Create customization that handles mapping based on Order Line Attributes
  2. Sell item with Shopify
  3. Import order to BC, which gets the "Not everything can be mapped" error
  4. Click "Create Sales Documents"
  5. Sales order is now created

Additional context

No response

I will provide a fix for a bug

JesperSchulz commented 3 months ago

Feel free to create e PR for this.