Open multiple documents, each in a new tab

1
I am currently working on a project where the user searches for certain (PDF) documents and wants to open one or more in new browser tabs. The way that I do it now is that the PDF files are generated in a microflow, followed by a Download File action that uses the PDF FileDocument as input and the checkbox “Show file in browser instead of downloading, if possible” checked. This works perfectly for one document, but as soon as I try to open a second document, it opens in the same new tab as the first document did, so the first document is not available anymore. How do I change this behavior so that each document is opened in a new tab, leaving the other new tabs untouched?
asked
3 answers
2

Following on the URLRedirector idea, you can build a URL to your file in a few ways:

 

In a nanoflow:

This is the easiest way to build a URL. Make a JavaScript action and pass it your fileDocument as a parameter called ‘obj’. Then your code is just:

return mx.data.getDocumentUrl(obj.getGuid(), obj.get("changedDate") as number);

You can also open a new tab in a JavaScript action to avoid the URL redirector widget altogether:

window.open(url, '_blank');

 

In a microflow:

You can use a few actions from CommunityCommons to make the URL. The general structure is like this:

https://myapp.com/file?guid=24124132

So you can build this URL by combining:

  1. CommunityCommons.getApplicationURL
  2. “file?guid=”
  3. CommunityCommons.getGUID
answered
1

Maybe you can do something with the urlredirector widget?

https://appstore.home.mendix.com/link/app/113/

answered
1

As far as I know microflows can execute the download file action only once.

I think the easiest way to achieve what you want is to separate the microflow actions by calling them separately from a nanoflow.

Edit: This does work for downloading multiple files but when setting 'Show file in the browser instead of downloading’ it will result in the same behaviour that you have described. 

answered