At Pragmatic Works, we frequently encounter challenges that are unique to our users' needs. In this week's video, Matt Peterson, a trainer at Pragmatic Works, tackled an issue raised by a client during a virtual mentoring session. The client wanted users to be able to edit records and add attachments in a Canvas App, but without the ability to delete them. This tutorial demonstrates the steps to address this need effectively using Canvas App logic.
The client’s requirement was clear: users should be allowed to edit records, add attachments, but not delete them. In Canvas Apps, the attachment control includes a delete icon by default, but unfortunately, there is no out-of-the-box solution to simply hide or remove the delete icon. This meant Matt had to get creative to ensure that users could not remove attachments once they were added.
Initially, Matt considered removing the delete icon by simply hiding it, but after some exploration, he realized that Canvas Apps doesn’t allow for hiding the delete button directly through properties. So, he had to find another solution.
The first solution Matt came up with worked well when there was only one file allowed in the attachment. Using a variable, he could track whether the user had deleted a file or not and disable the save button accordingly. However, this approach only worked when there was a single attachment per record. Since the requirement was for multiple attachments, Matt had to revise his approach.
Matt’s final solution uses global variables to track changes in the record and control the functionality of the save button.
VAR_disable_save, to control whether the save button is enabled or disabled.While Canvas Apps doesn't offer a direct way to remove the delete icon for attachments, Matt's approach with global variables is a clever workaround. By using conditional logic, variables, and notifications, he successfully ensured that users could edit records and add attachments without being able to delete them. This solution is perfect for users facing similar challenges and looking for a creative way to handle attachment management in Canvas Apps.
For more practical tips and tutorials, make sure to subscribe to Pragmatic Works’ training resources and stay up to date with the latest in app development!
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Canvas Apps and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.