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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

When opening an excel file I get this error: "Object reference not set to an instance of an object"

(0) ShareShare
ReportReport
Posted on by 5

after debugging I found this code is what's causing the error, 

 pastedimage1651743405724v2.png

ExportToExcelFilterTreeBuilder headerFilterBuilder = new ExportToExcelFilterTreeBuilder(resourcestr(PDEImportSheetPicking));

I checked template name all is fine, I refreshed the entities list. nothing helped

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DatWard,

    This looks like a custom class. The new method in ExportToExcelFilterTreeBuilder class is looking for the data entity name.

    pastedimage1651746198098v1.png

    Here you are passing resourcestr(PDEImportSheetPicking). Is PDEImportSheetPicking your data entity name? If so, could try this line of code and check if that resolves your issue?

    ExportToExcelFilterTreeBuilder headerFilterBuilder = new ExportToExcelFilterTreeBuilder(tableStr(PDEImportSheetPicking));

  • DatWard Profile Picture
    5 on at

    Hi Gunjan!

    Yes that's staging table of data entity. I tried your code... same error

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DatWard,

    In that case, you will need to replace PDEImportSheetPicking with the name of the entity. Assuming the name of the entity is PDEImportSheetPickingEntity, your code will look like this -

    ExportToExcelFilterTreeBuilder headerFilterBuilder = new ExportToExcelFilterTreeBuilder(tableStr(PDEImportSheetPickingEntity));

    You can check getDocumentFilters method in BudgetPlanLoadAttachment as an example where the entity is passed to the new method of ExportToExcelFilterTreeBuilder class

    pastedimage1651747686005v1.png

  • DatWard Profile Picture
    5 on at

    Hello GunJan. didn't work. although I followed error this is where I get error from

    6114.error.jpg

    this is exactly where I get this error, could it be those fields?

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DatWard,

    Are you able to open excel from other standard forms in the application?

  • DatWard Profile Picture
    5 on at

    Hi Gunjan.

    Didn't quite understand the question

  • DatWard Profile Picture
    5 on at

    I think you're right I get this error (from same line) when I'm trying to open this form

     pastedimage1651847181564v1.png

    The form I'm trying to open:

    pastedimage1651847252951v2.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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans