D365 Export to PDF
Having Word templates is great, but directly creating PDF files is even better.
We already presented you a tutorial, how you could create this with code: Dataverse Custom API Preview (Dynamics 365 CDS).
In this trick, I show you, how you can enable this feature for your users.
Open Sales Hub App
The configuration is done in the Sales Hub App, but can also be done within any other app:
https://<organization url>/main.aspx?pagetype=control&controlName=MscrmControls.FieldControls.CCFadminsettings&data=%7B%22id%22%3A%22enhance_pdf_generation%22%7D
If you have opened it in the Sales Hub App, switch to the "App Settings" area.
When you have opened the "App Settings", you will find the settings under "Settings" -> "Overview" -> "Convert to PDF".
Add Tables
You can now search for tables and enable them for PDF creation:
View it in action
As I enabled PDF creation for contacts, I'll open a contact and see, that there is a new button:
If you click on it, the PDF generation dialog is opened. You'll see all related Word templates and a preview of the generated document. In the command bar, you'll have several options:
- Download: Simply downloads the file
- Email: Creates a new CRM email and will attach the PDF
- Save to Dynamics: Add the created PDF as note attachment
- Save to SharePoint: Add the created PDF to SharePoint document location associated with the current record.
The SharePoint option is only available, if SharePoint integration is enabled for the current table. If SharePoint integration is enabled, the "Save to Dynamics" option will not be available.
If you didn't create a Word template yet, you'll receive an error message:
D365 Export to PDF
Comments
You can simply open the…
You can simply open the following url, replacing the "organization url" with your actual organization url
https://<organization url>/main.aspx?pagetype=control&controlName=MscrmControls.FieldControls.CCFadminsettings&data=%7B%22id%22%3A%22enhance_pdf_generation%22%7D
Or alternatively, when you have opened D365 CE, you can switch to the Sales Hub App
This option can not be enabled for the Case entity
I want to enable this for the Case entity, but it seems this entity is not in the list of entities you can select.
There is no documented way…
There is no documented way to achieve this. In the UI, only the following entities are available:
- All custom entities, which are enabled for advanced find and which have an object type code greater than 10000
- Account
- Contact
- Lead
- Opportunity
- Quote
- Salesorder
- Invoice
However, the enabled entities can be set with a PATCH request to the following URL:
https://<crmurl>/api/data/v9.0/pdfsettings(3e5d32bb-3fd3-424e-81f0-7d4faf5aee94)
I recommend doing a GET request first, to get the enabled entities:
{
"@odata.context": "https://org51eb14c6.crm4.dynamics.com/api/data/v9.0/$metadata#pdfsettings(pdfsettingsjson)/$entity",
"@odata.etag": "W/\"8321032\"",
"pdfsettingsjson": "{\"quote\":true}",
"pdfsettingid": "3e5d32bb-3fd3-424e-81f0-7d4faf5aee94"
}
Add the incident entity to the property "pdfsettingsjson" and make the PATCH request:
{
"pdfsettingsjson": "{\"quote\":true,\"incident\":true}"
}
Please keep in mind, that the incident entity will not be visible in the enabled entities in the Sales Hub - General Settings. Also if you change the enabled entities in the Sales Hub - General Settings, the incident entity will be removed from the list again.