# Understanding connection between promotion and order row in Connect ERP

**URL:** <https://forum.litium.com/t/understanding-connection-between-promotion-and-order-row-in-connect-erp/3257>\
**Category:** Questions\
**Created:** [May 1, 2024, 6:17pm UTC](https://forum.litium.com/t/understanding-connection-between-promotion-and-order-row-in-connect-erp/3257 "2024-05-01T18:17:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixfroberg](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@felixfroberg](https://forum.litium.com/u/felixfroberg)\
**Post date:** [May 1, 2024, 6:17pm UTC](https://forum.litium.com/t/understanding-connection-between-promotion-and-order-row-in-connect-erp/3257/1 "2024-05-01T18:17:59Z")

</div>

Hi,

We’re using Connect ERP (endpoint /api/connect/erp/orders/) to read orders for an ERP integration. In the ERP we want to store the price of each product after any discounts rather than saving product discounts as separate rows.

The data from Connect ERP looks something like this:

```auto
{
  "id": "LS10049",
  "rows": [
    {
      "id": "1",
      "type": "product",
      "articleNumber": "302212",
      "descriptions": "Dot knopp mässing",
      "unitPriceIncludingVat": 102,
      "unitPriceExcludingVat": 81.6,
      "quantity": 1,
      "unitOfMeasurement": "st",
      "vatRate": 0.25,
      "totalIncludingVat": 102,
      "totalExcludingVat": 81.6,
      "totalVat": 20.4,
      "additionalInfo": {}
    },
    {
      "id": "2",
      "type": "product",
      "articleNumber": "1349965",
      "descriptions": "Bottenventil pop up svart med stort lock med bräddavlopp",
      "unitPriceIncludingVat": 620,
      "unitPriceExcludingVat": 496,
      "quantity": 1,
      "unitOfMeasurement": "st",
      "vatRate": 0.25,
      "totalIncludingVat": 620,
      "totalExcludingVat": 496,
      "totalVat": 124,
      "additionalInfo": {}
    },
    {
      "id": "3",
      "type": "promotion",
      "articleNumber": "302212",
      "descriptions": "sales.discounttypes.productcampaignprice.title",
      "unitPriceIncludingVat": 42,
      "unitPriceExcludingVat": 33.6,
      "quantity": 1,
      "unitOfMeasurement": "",
      "vatRate": 0.25,
      "totalIncludingVat": 42,
      "totalExcludingVat": 33.6,
      "totalVat": 8.4,
      "additionalInfo": {}
    }
  ],
  "promotions": [
    {
      "id": null,
      "description": null,
      "type": "product",
      "discountType": "DiscountedProductPrice",
      "additionalInfo": {},
      "sourceOrderRowIds": [
        "82821240-961c-4dd2-9156-43660de902c7"
      ],
      "resultOrderRowId": "45961bff-c1a2-444b-814f-e2711ba77255"
    }
  ]
}

```

What’s the best way to map the promotion data to the corresponding products to calculate the final price? Should we map based on `articleNumber` or use the `promotions` property for this? `promotions` seem to contain the mapping between `product` rows and `promotion` rows, but uses systemids which is not available under `rows`.

Litium version: _8.15.0_

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [May 29, 2024, 6:18pm UTC](https://forum.litium.com/t/understanding-connection-between-promotion-and-order-row-in-connect-erp/3257/2 "2024-05-29T18:18:54Z")

</div>

Closed on May 29, 2024, 6:18pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
