It’s been sometime that I wrote a blog and what better time to write than on Christmas eve when holidays are finally here.
This blog is going to be slightly different from my usual blogs on PowerAutomate and PowerApps. In this blog I am going to discuss the following.
- You have ‘Export to PDF’ enabled for all tables but wondering how to disable that option for few of them?
- You are not using Dynamics 365 for Sales and wondering how do I enable or disable Export to PDF option as you don’t find a UI to do the same.
- You want to enable/ disable Export to PDF option dynamically using code.
Before I go ahead and start with the solution, you should first understand the feature I am discussing here. You can read more about it in details in Microsoft Docs link. But for a brief explanation, you can use the Export to PDF option to generate a PDF document for your CDS records based on document template.
So that’s a brief introduction. But why this blog? Well, it’s a sales related feature and if you are using Dynamics 365 for Sales, you can enable or disable this option for entities from Sales related settings.
But things become a bit problematic when you are not using Dynamics 365 for Sales App. This is because if you want to enable/ disable these options, you don’t find a UI to do the same. The blog will help you do just that.
I am using POSTMAN here. However you can do the same thing using code.
To update using code, we basically need to send a PATCH request to the below URL
https://<crmurl>/api/data/v9.0/pdfsettings(3e5d32bb-3fd3-424e-81f0-7d4faf5aee94)
More importantly, it’s the payload you need to pass. Below is the format you in which you need to send the data in the body of the request.
{"pdfsettingsjson":"{\"contact\":false}"}
In the above contact, I want to set the setting for contact to false.
Screenshot from POSTMAN
Quite obviously, you would need to pass the bearer token to authorize with CDS which I am not going to explain here. You have hundreds of wonderful resources available for that topic.
You may also like the below posts
Hope this helped!
Debajit Dutta
Business Solutions MVP
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.