In this blog, we show you how to upload a camera photo from a Canvas App to Dynamics 365 as an attachment on a particular entity record.
So, you're building a custom SSRS report using FetchXML and you have the requirement to display images from Notes in Dynamics 365.
(If you need some initial setup assistance, see one of our previous blogs, Quotes: How to Display an Image Stored in Dynamics 365 on an SSRS Report, for help.)
Now, fast forward to deploying and testing your report within Dynamics 365. If everything looks great except the images didn't render properly, you're probably thinking, "What the heck?!" Perhaps you see a little red X, maybe the image is only half-loaded or pixelated, or it could be a combination of these. Regardless, it's frustrating! Here are a few potential quick solutions for image rendering issues that may be just what you need…
1. Review the header of your FetchXML behind the dataset bringing those images into the report: is distinct="true" in there? If so, this is likely the source of your image rendering problem. Set it to false or, better yet, simply remove the whole condition if you don't need it.
2. When it comes to rendering images nicely, Dynamics 365 has a size limit of 75 KB. It might render an image over 75 KB, but it won't like doing it and it you probably won't like the results! As a safeguard against inadvertently attempting to display an image that exceeds the limit, consider adding a Row Visibility expression to hide an image greater than 75 KB. For example: =IIF(Fields!NOTE_filesize.Value/1024 > 75, True, False) where this would be Set expression for: Hidden.
3. Another solution is to avoid this size limitation altogether by reducing the size of your images within Dynamics 365. Now, there is no way to reduce the size of the original image that is added, but you can trigger a plugin that makes a copy of the image and reduces its size in the process. Most likely, your images are attachments onto Notes, and your plugin can have a logic flow like this:
IF Note contains an image attachment
IF image file size < configurable max value
- Reduce the quality by configurable percentage and shrink the image (maintaining scale) so the largest side matches the configurable value; repeat if still too big
- Replace original image with newly reduced image
This, along with collaboration of your Row Visibility expression from #2 above, will prevent those big, unwanted images from trying to render and display in your report.
Hopefully these solution(s) help clear up some image rendering issues. Be sure to subscribe to our blog for more Dynamics 365 tips and tricks!