Hi all,
We are working on enabling the new pricing calculations feature in Business Central (v19) and we are facing the below issue;
Our Sales Price list lines are per campaign example;
| Source Type | Source No | Type | Product No | Currency | Unit Price | Status |
| Campaign | Campaign1 | Item | Item 1 | EUR | 200 | Active |
| Campaign | Campaign1 | Item | Item1 | USD | 250 | Active |
| Campaign | Campaign2 | Item | Item1 | EUR | 300 | Active |
| Campaign | Campaign2 | Item | Item1 | USD | 350 | Active |
When preparing a Sale (example; a Sales Quote), and input an item as line, we go to Functions > Get Price to show price list lines of the chosen item, depending on the quote's (sales header) campaign no. and currency.
So far so good and works as expected. The problem then becomes when we change the currency and then change the campaign no i.e.
1. Create Quote Q1234 - Currency: USD - Campaign: Campaign 1 - Item: Item 1
2. We select 'Get Price' action and it shows us the correct price list line i.e. that of 250 Unit Price.
3. We change the quote's currency to EUR and change the campaign to Campaign2, select Get Price action and BC still shows us the price of Campaign 1 as if it did not realize that the campaign has been changed.
I debugged the issue and found that the issue is in this piece of code in Table 37 that is run each time the 'Get Price' Action is selected;
Looks like the first run i.e. when Campaign 1 was selected in step 1, the Sales Header variable is correctly populated with Q1234 and Campaign 1. Then on the second run (step 3), the SalesHeader variable is not cleared therefore the if statement fails as the SalesHeader is already populated and the SalesHeader.Get statement is not actioned, hence leaving the SalesHeader variable populated with the 'old' version of the Sales Header.
There do not seem to be any events we can subscribe to so as to avoid this.
Any ideas how we can overcome such strange behavior, please? Tried this also in a sandbox environment with no customisations and got the same result.
Thanks in advance!

Report
All responses (
Answers (