The issue under discussion is the 'PDF Creation Failed' error in Canvas Apps when checking conditions on a gallery and using the PDF export function. This problemoccurs when application users have two galleries. The first gallery is populated with items, which upon moving to a collection, are displayed in the secondary gallery. If either gallery is empty, it leads to the 'PDF Creation Failed' error message.
The problem persists in attempts at resolving the situation through various 'combination' strategies, such as eliminating the first gallery from the PDF conversion if it is empty. However, PowerApps seems to ignore the conditions, leading to a failure in generating the PDF. This is not limited to when the gallery is empty. Furthermore, attempting to introduce a condition at the start of the Office365Outlook.SendEmailV2() function to eliminate this gallery also results in the same error.
Upon retesting under similar conditions, it was noted that the issue occurs when checking a condition for the gallery in combination with the PDF function and the Outlook connector. A potential workaround for this situation is suggested. This method recommends adding a toggle control to the screen, having as default value: IsEmpty(yourGallery.AllItems). This control should be hidden. Lastly, the if condition should be replaced to check the control default value rather than the gallery.
The Canvas App's functionality concerning PDF creation in the presence of an empty gallery in an application is under question. Several attempts at troubleshooting the situation, often involving codes to exclude the empty gallery or using Microsoft Outlook's SendEmailV2 function, have proved ineffective.
However, a viable solution involves implementing a system where a hidden toggle control checks the default value, replacing the process of checking the gallery itself. This alternate strategy has the potential to overcome the persistent 'PDF Creation Failed' error and improve application users' experience.
Microsoft Expert Answer: The issue of "PDF Creation Failed" when using a gallery and checking conditions in Canvas Apps can be fixed by using a toggle control and setting its default value to IsEmpty(yourGallery.AllItems). The toggle control should then be set to hidden. Instead of using an If condition to check the gallery for empty items, the condition should be replaced by checking the control's default value. This should resolve the issue of "PDF Creation Failed" when using a gallery and checking conditions in Canvas Apps.
Microsoft Canvas Apps, PowerApps, PDF function, Error, Gallery, Outlook Connector, Toggle Control