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

Showing XML file in new browser tab when formbutton is clicked.

(0) ShareShare
ReportReport
Posted on by

Dear Dynamics-enthusiasts, 

I'm currently working on a requirement where the client would like to see an xml opened when a button is clicked on a form. 

The form (and its) button work fine, the xml can be collected from the form datasource, and used to call below code: 

8357.pastedimage1582814131318v1.png

I was under the impression that this was the needed solution. 

However, after trying numerous things, I keep getting the same error: 

2783.pastedimage1582814204502v2.png

I was wondering whether anyone knows how to solve the error, or another way to satisfy the requirement (open xml in new browser tab after button click). 

All feedback, suggestions and help are more than welcome, and appreciated! 

Kind regards, 

Adil 

Junior D365 developer 

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,038 Most Valuable Professional on at

    For reference, we discussed something related in Show xml in Dynamics 365 for Operations Browser tab.

    What if you simply use File::SendStringAsFileToUser(reqLog.XML, 'XMLView22.xml')?

  • Community Member Profile Picture
    on at

    Hi Martin. Thankyou for your answer.

    I tried it, but it sends the file to the user (as the methodname literally says) so that the user can download it.

    My requirement however is to immediately show the file in a new browser tab. The user does not need to download/click extra times. Just 1 click on an D365 form, and a new browserwindow should popup with the XML inside.

    So in short: form button click -> new browser window with the xml on it. Anything short of that exact functionality is not what I'm looking for.

    About the other post, I've read it and tried the suggestions there as well. Maybe this requirement just transcends AX's scope.  

  • Crispin John Augustine Profile Picture
    37,081 on at

    Interesting requirement, your code just sends the file download URL to the browser object,

    whereas the download has to already happen, and you have to pass the "..localpath\filename.." to the browser object (instead of download URL).

    How exactly? I'm not sure, but will update here if I figure out.

    I know for sure it is possible

  • Crispin John Augustine Profile Picture
    37,081 on at

    @Admin(s), this is for 365 Finance forum, btw. If one of you could kindly move?

  • Verified answer
    Martin Dráb Profile Picture
    239,038 Most Valuable Professional on at

    The web server doesn't know anything about features of certain browsers such as tabs and has no control over it. This is managed by the browser itself. For example, the thread How to force open links in Chrome not download them? explains how you can configure Chrome to open certain types of files directly instead of downloading them.

  • Crispin John Augustine Profile Picture
    37,081 on at

    That is very interesting to know.

    Could that be also then a default browser setting like "Download files automatically"? or something similar.

    My certainty was from a reporting tool, that opens a report in the browser.

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 March 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 658

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans