This post is part of a series of posts. Please use the links below to navigate through the related posts:
- Macro Templates Introduction
- Deployment
- Dataverse Tables
- Custom Page Dialog
- Power Automate Flow
- Javascripts
- Template File
- Final Notes
- Git Sources
Here are just a few final notes
- Make sure to add your Dataverse environment to the trusted sites, since, from the browser standpoint, this is where you’ll be downloading the document from, and, as long as it’s “trusted”, it’ll be much easier to run the macro
- When using Xrm.Navigation.navigateTo to open a custom page in your MDA application, make sure that page has been added to the application in the first place. It does not have to be visible in the navigation, it just has to be added to the app. Since, if not, a call to navigateTo won’t fail, but it won’t open a custom page either
- You can pass extra parameters to your custom page through the entitytype – it’s just a string parameter after all, so use json (I’m not saying it’s an official recommendation, I’m just saying it works)
- There seem to be no way to pass custom page dialog “execution results” back to the calling javascript, but we can use a dataverse table for that (create a record there, then read it on the javascript side. Just need to be able to identify it, but see above for passing extra parameters to the custom page – you can pass some sort of a “key”)
- How useful is this solution overall? Well, it depends. Business team gets a lot of control over the templates, they have expertise in creating those VBA macros, and such templates are extremely flexible. On the flip side, a generated document can’t be stored somewhere automatically, it can’t be sent by an email (since we can’t run the macro automatically), so there is always user interaction involved.