Hi Sebastian,
In Dynamics 365 Finance there isn’t a direct one‑to‑one mapping from Sales tax group (often called “TaxGroup”) + rate to a single Item sales tax group. The engine applies tax based on the intersection of tax codes that are present in both the Sales tax group attached to the transaction and the Item sales tax group attached to the product. Practically, you’re looking for any item sales tax group that shares at least one sales tax code with your sales tax group, where that code’s effective percentage equals your target (e.g., 19%). [1][2]
Functional approach (no code):
- Identify the sales tax code(s) that are set to 19% for the relevant effective date(s).
- For each such code, verify membership: it must be included both in your Sales tax group and in an Item sales tax group. Any item sales tax group that contains one of those codes is a candidate. The combination applies when both groups include the same code. [1][2]
If your environment uses the Tax Calculation service (Globalization Studio), the logic is equivalent: it uses tax group × item tax group intersection. Item tax groups there sync with item sales tax groups in Finance. [2]
Query/X++ approach (conceptual):\
You can resolve it with a join over the linking tables that associate groups to codes:
- TaxGroupData → links Sales tax group to sales tax codes
- TaxOnItem (or equivalent) → links Item sales tax group to sales tax codes\
Joining these by TaxCode gives you item sales tax groups that intersect with your sales tax group. Then filter by the tax code value = 19% for the effective date. [3][4]
public static void findItemSalesTaxGroups(
TaxGroup _salesTaxGroup, // your Sales tax group
real _ratePercent, // e.g., 19.0
TransDate _asOfDate)
{
TaxGroupData tgd; // Sales tax group ↔ TaxCode
TaxOnItem toi; // Item sales tax group ↔ TaxCode
TaxCode tc;
TaxData tv; // date-effective tax values (rate)
TaxItemGroupHeading tig; // item sales tax group header
// Find item sales tax groups where there exists a code that:
// 1) belongs to the given Sales tax group
// 2) belongs to the item sales tax group
// 3) has an effective percentage equal to _ratePercent on _asOfDate
while select distinct tig.TaxItemGroup
join toi
where toi.TaxItemGroup == tig.TaxItemGroup
join tgd
where tgd.TaxCode == toi.TaxCode
&& tgd.TaxGroup == _salesTaxGroup
join tc
where tc.TaxCode == tgd.TaxCode
join firstonly tv
where tv.TaxCode == tc.TaxCode
&& tv.FromDate <= _asOfDate
&& tv.ToDate >= _asOfDate
&& tv.Percent == _ratePercent
{
info(strFmt("Candidate Item sales tax group: %1", tig.TaxItemGroup));
}
}
The key idea is the common tax code across the two groups; the rate check comes from the tax code’s date‑effective value. The same join pattern is used when fetching tax rates programmatically. [3][4]
Tip: If you need to validate this without development, create an inquiry/filter over Sales tax codes at Tax ▸ Indirect taxes ▸ Sales tax ▸ Sales tax codes, filter for 19%, then open each code and review the Sales tax groups and Item sales tax groups that include it. The overlapping item groups are the ones you’re after. [1]
If this addresses your question, please mark the reply so others can find it.
Thanks and best regards,\
Daniele\
Note: This response was prepared with support from Copilot to ensure clarity and completeness.