Macro Templates solution: can’t do it without a javascript web resource

By | March 28, 2024

This post is part of a series of posts. Please use the links below to navigate through the related posts:

I’ve already mentioned the javascript when explaining how custom page dialog works, so you might want to re-read that part quickly, there are just a few more things to mention.

Here is how file download works:

  • There is a “fetch” call to get the file from a url (in this case we are talking about the template selected through the custom page dialog, so it’s really a link to a file stored in the dataverse file field)
  • Then the javascript create a url for the in-memory blob, and it “clicks” that link right away to finally download the file to the users device

Important: from the browser perspective, the file gets downloaded from the Dataverse environment. You need to add that environment to the trusted sites, since, otherwise, you’ll have quite a few problems when trying to run the macros.

And, then, there is openTemplateDialog function in the script which is called from the Power FX command button as described here. That’s not a huge script, but it really connects all the other pieces together.

Leave a Reply

Your email address will not be published. Required fields are marked *