Power Up - Upskill Yourself...
โŒ

Normal view

Before yesterdayMain stream
  • โœ‡Microsoft Dynamics 365 CRM Tips and Tricks
  • Generating and Sharing Screen in PDFs from D365 Sales Using Canvas Apps
    In many Dynamics 365 Sales implementations, sales users need a simple and intuitive way to preview a quote, generate a PDF, and share it with customers. Traditionally, this requirement is handled using Word templates, which often feel rigid, require backend configuration, and do not provide a smooth preview experience for users. Microsoft has introduced PDF generation and PDF preview capabilities in Canvas apps, making it possible to convert Canvas app screens or containers into PDF files and p
     

Generating and Sharing Screen in PDFs from D365 Sales Using Canvas Apps

Canvas Apps

In many Dynamics 365 Sales implementations, sales users need a simple and intuitive way to preview a quote, generate a PDF, and share it with customers. Traditionally, this requirement is handled using Word templates, which often feel rigid, require backend configuration, and do not provide a smooth preview experience for users.

Microsoft has introduced PDF generation and PDF preview capabilities in Canvas apps, making it possible to convert Canvas app screens or containers into PDF files and preview them directly within the app. These capabilities open new possibilities for creating user-friendly, preview-first document generation experiences in D365 Sales.

In this blog, we demonstrate how to build a Canvas app that allows users to view quotes, preview quote details as a PDF, and prepare the PDF for sharing, all using native Power Apps functionality.

How This Works (High-Level Overview)

This approach uses a Canvas app embedded in D365 Sales to display quote data. A specific container holding the quote layout is converted into a PDF using the PDF() function. The generated PDF is stored in a variable and passed to the PDF Viewer control, allowing users to preview the document before sharing or processing it further.

App Design Overview

To keep the user experience simple and intuitive, the app is designed with two screens.

Screen 1: Active Quotes

The first screen displays active quotes in a gallery, as shown below.

This screen acts as the entry point for the user and allows quick selection of a quote.

When a user selects a quote:

  • The selected quote is stored in a variable
  • The app navigates to the quote preview screen

Generating and Sharing Screen in PDFs

This approach keeps quote selection fast and avoids unnecessary navigation between screens.

Screen 2: Quote Details and Quote Preview

The second screen is designed to display quote details and a PDF preview side by side.

On this screen, I have used two containers:

  • One container to display the quote details
  • Another container to preview how the quote will appear in the PDF Viewer

To display the PDF in the PDF Viewer, the following approach is used:

Generating the PDF

The PDF() function is used to generate a PDF from the quote details container.
The generated PDF is stored in a variable (MyPdf).

Generating and Sharing Screen in PDFs

This ensures that the same layout used to display quote details is reused for PDF generation.

Previewing the PDF

The MyPdf variable is then passed to the PDF Viewer control, allowing users to preview exactly how the PDF will look before it is shared.

Generating and Sharing Screen in PDFs

This provides a true โ€œwhat you see is what you getโ€ experience for the user.

Below is how the page layout looks with the quote details on one side and the PDF preview on the other.

Generating and Sharing Screen in PDFs

ย 

Generating and Sharing Screen in PDFs

Important Note on Experimental Features

At the time of writing, both the PDF () function and the PDF Viewer control are marked as Experimental features in Power Apps.

Benefits of This Approach

  • Preview-first user experience
  • No dependency on Word templates
  • Flexible and easily customizable layouts
  • Consistent PDF output
  • Simple integration with Power Automate for further processing

Real-World Use Cases

This pattern can be applied across multiple D365 Sales and business scenarios, including:

  • Quote generation and sharing
  • Invoice previews
  • Order confirmations
  • Service reports
  • Custom sales documents

The same reusable layout approach ensures consistency across documents while keeping the user experience simple.

FAQs

Can Canvas apps generate PDFs in D365 Sales?
Yes. Canvas apps support the PDF() function, which allows screens or containers to be converted into PDF files that can be previewed or shared.

Do I need Word templates to generate PDFs in D365 Sales?
No. This approach removes the dependency on Word templates by generating PDFs directly from Canvas app layouts.

Can users preview PDFs before sharing them?
Yes. The PDF Viewer control allows users to preview the generated PDF inside the Canvas app before sharing.

Can this be integrated with Power Automate?
Yes. The generated PDF can be easily passed to Power Automate for emailing, storage, or further processing.

Conclusion:

By combining Canvas apps with the PDF() function and PDF Viewer control, it is now possible to create lightweight and flexible document generation experiences directly within D365 Sales.

This approach allows users to preview, generate, and share quote PDFs using a single reusable layout, improving usability and reducing dependency on backend templates.

The same pattern can be extended to other scenarios such as invoices, orders, service reports, or any use case where formatted documents are required.

The post Generating and Sharing Screen in PDFs from D365 Sales Using Canvas Apps first appeared on Microsoft Dynamics 365 CRM Tips and Tricks.

  • โœ‡Microsoft Dynamics 365 CRM Tips and Tricks
  • Understanding App Functionality Through Code View in Power Apps
    When building applications using Power Apps, especially Canvas apps, understanding the underlying functionality is crucial for effective development and maintenance. One powerful feature that enables developers to gain deeper insights into their appโ€™s behavior is the Code View. In this blog post, weโ€™ll explore the purpose of Code View, how to navigate it, and why it is essential for building robust applications. This capability allows you to: Visualize Control Code: Access the code for each co
     

Understanding App Functionality Through Code View in Power Apps

App Functionality Through Code View in Power Apps

When building applications using Power Apps, especially Canvas apps, understanding the underlying functionality is crucial for effective development and maintenance. One powerful feature that enables developers to gain deeper insights into their appโ€™s behavior is the Code View. In this blog post, weโ€™ll explore the purpose of Code View, how to navigate it, and why it is essential for building robust applications.

This capability allows you to:

  • Visualize Control Code: Access the code for each control in your app, helping you grasp how they function and interact.
  • Share Code Externally: Easily copy the code for control and share it outside of Power Apps Studio, facilitating collaboration and feedback.
  • Duplicate Controls: Copy and paste control code to create new instances, streamlining the development process and enhancing efficiency.

By utilizing Code View, you can enhance your app development experience and gain deeper insights into how your Canvas app operates.

Prerequisites for Using Code View in Power Apps

Before you can view the code for control in Power Apps, ensure that the Power Fx formula bar is enabled. Hereโ€™s what you need to know:

Enabling the Power Fx Formula Bar:

  • Default Setting: The Power Fx formula bar is turned on by default for new apps.
  • For Existing Apps: If youโ€™re working on an existing app and need to enable the formula bar, follow these steps:
    1. Open your app in Power Apps Studio.
    2. Navigate to Settings.
    3. Go to Upcoming features.
    4. Select Preview.
    5. Toggle the Power Fx formula bar to ON.

Once the Power Fx formula bar is activated, youโ€™ll be able to access and view the underlying code for your controls in Code View. This will enhance your ability to understand and manipulate the appโ€™s functionality effectively.

Steps to View, Copy, and Paste Code for a Control

  1. Open Your App: Launch your app for editing in Power Apps Studio.
  2. Access the Control:
    • Right-click on the control in the Tree view or directly on the screen.
    • Select View code (preview).

App Functionality Through Code View in Power Apps

  1. View the Code: The code for the selected control and its underlying components will be displayed.

App Functionality Through Code View in Power Apps

  1. Copy the Code:
    • Click on Copy code.
    • You can then paste the copied code into any window outside of your brows

App Functionality Through Code View in Power Apps

  1. Generate a New Control:
    • To create a new control from the copied code, right-click on the location where you want the new control to be created.
    • Select Paste code (preview).

App Functionality Through Code View in Power Apps

  • Ensure you use the YAML format generated by Power Apps Studio for the best results.
  • The code will undergo a validation check before the new control is created, ensuring that it adheres to the expected standards.

By following these steps, you can effectively view, copy, and paste code in Power Apps, making your development process more efficient and streamlined.

Important Notes

While Code View is a powerful tool for understanding and manipulating your appโ€™s functionality, itโ€™s important to be aware of its limitations. Here are some key points to keep in mind:

  • No App Object Access: You cannot copy and paste or view code for the App Object. Code View is limited to individual controls on the screen.
  • No Code Editing: The code displayed in Code View cannot be directly edited. It is purely for viewing and copying purposes.
  • Control Copying Restrictions: You can only copy controls that are present on a screen. Copying an entire screen is not supported.

Conclusion

Using Code View in Power Apps provides a powerful way to understand and manipulate your appโ€™s functionality. By viewing the code representation of each control, sharing configurations, and easily duplicating controls, you can enhance your development experience and create more robust applications. Embrace Code View to unlock the full potential of your Canvas app!

Canvas App

The post Understanding App Functionality Through Code View in Power Apps first appeared on Microsoft Dynamics 365 CRM Tips and Tricks.

โŒ
โŒ