web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

D365FO ER: "List is empty" error for TaxTrans/ExemptCode in Free Text Invoice report

(3) ShareShare
ReportReport
Posted on by 58

We are experiencing an issue while running an Electronic Reporting (ER) format for not posted Free Text Invoices in Dynamics 365 Finance & Operations (D365FO). The report fails with the following error message:

"An error occurred during the 'Format mapping' run. Evaluating expression for path 'TaxTrans/ExemptCode'. List is empty at 'model/LineItem/TaxTrans'"

Context & Setup:

  • Model Mapping:

    • TaxTrans is linked to LineItem in the model (Invoice line - item(LineItem) = CustInvoiceJour.'$CustInvoiceTrans_OrderByLineSeqNum')
    • The reference path for TaxTrans is: CustInvoiceJour.'$CustInvoiceTrans_OrderByLineSeqNum'.'$TaxTrans_All' (Tax transaction(TaxTrans) = @.'$TaxTrans_All'
    • It is correctly mapped in the Model Mapping Designer.
  • Format Mapping:

    • The ExemptCode is mapped using: IF(@.TaxTrans.ExemptCode<>"", @.TaxTrans.ExemptCode, "")
    • The LineItem section correctly retrieves data, except when TaxTrans is empty.

Troubleshooting Steps Tried:

  1. Added a Condition to Prevent Empty List Errors:

    IF(COUNT(@.TaxTrans) > 0, IF(@.TaxTrans.ExemptCode<>"", @.TaxTrans.ExemptCode, ""), "")
    • This still causes the "List is empty" error.
  2. Attempted Using ALLITEMSQUERY to Retrieve Tax Transactions:

    ALLITEMSQUERY(CustInvoiceJour.'$CustInvoiceTrans_OrderByLineSeqNum'.'$TaxTrans_All')
    • This led to validation errors stating "The parameter of ALLITEMSQUERY function must be a valid path to a datasource element of the 'record list' data type."
  3. Tried Using FILTER to Process Only Non-Empty Tax Transactions:

    FILTER(@.TaxTrans, COUNT(@.TaxTrans) > 0)
    • But we got "The list expression of FILTER function is not queryable."
  4. Considered Returning an Empty List When TaxTrans is Empty:

    IF(COUNT(@.TaxTrans) > 0, @.TaxTrans, EMPTYLIST(@.TaxTrans))
    • This did not resolve the error either.

Question:

✅ How do we safely reference TaxTrans.ExemptCode in the format mapping to prevent the "List is empty" error when TaxTrans has no records?

Additional Questions:

  • Is there a better way to prevent ER from attempting to evaluate TaxTrans when it is empty?
  • Should this issue be handled in the Model Mapping, or is there an alternative approach in the Format Mapping?
  • Is there a known workaround for making TaxTrans optional without causing errors?

Any guidance or best practices would be greatly appreciated! Thanks in advance for your support. 🙏

Categories:
I have the same question (0)
  • Suggested answer
    Adis Profile Picture
    6,686 Super User 2026 Season 1 on at
    Hi,
     
    First of all: Good job with the information provided and the effort of trying.
     
    Approach 1:
    I think this is the issue.
    IF(COUNT(@.TaxTrans) > 0, IF(@.TaxTrans.ExemptCode<>"", @.TaxTrans.ExemptCode, ""), "")
     
     
    I handle the similar issue like the following. I know I am using the TaxTrans.Rate here, that is a number.
     
    IF
    (
        NOT(ISEMPTY(model.'$ProjectList'.'$LineEmployee'.TaxTrans)),
        model.'$ProjectList'.'$LineEmployee'.TaxTrans.Rate,
        0.0
    )
     
     
     
    Your case would be:
     
    IF
    (
        NOT(ISEMPTY(@.TaxTrans)),
        @.TaxTrans.ExemptCode,
        ""
    )
     
     
     
     
    Approach 2:
     
    From the standard format you may find a different approach or actually the solution.
     
     
    Kind regards, Adis
     

    If this helped, please mark it as "Verified" for others facing the same issue

     
     
  • Verified answer
    Elise De Brie Profile Picture
    58 on at
    The issue has been resolved by adding a condition in the format mapping on the ExemptCode field "NOT(ISEMPTY(@.TaxTrans))

    Uploaded image: No description set. image.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 620

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 521 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans