Thu, 02/25/2021 - 13:45 By Fabian Kalchofner Contributor Lloyd Sebag
5 comments

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.

D365 Export to PDF

When you have opened the "App Settings", you will find the settings under "Settings" -> "Overview" -> "Convert to PDF".

D365 Export to PDF

 

Add Tables

You can now search for tables and enable them for PDF creation:

Enable PDF Generation

 

View it in action

As I enabled PDF creation for contacts, I'll open a contact and see, that there is a new button:

Export to PDF 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.

Export to PDF dialog

 

If you didn't create a Word template yet, you'll receive an error message:

D365 Export to PDF

D365 Export to PDF

Comments

You say in "any app" you can do this. How do I set this up in D365 CE?

Thu, 02/10/2022 - 15:58
Tim Dailey (not verified)

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

Sales Hub App

Tue, 02/22/2022 - 13:10

In reply to by Tim Dailey (not verified)

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.

Wed, 01/04/2023 - 11:05

In reply to by Renate in 't Zandt (not verified)

Add new comment

Image CAPTCHA
Enter the characters shown in the image.