WOAH! First Power Pages post! It’s taken me long enough to start covering topics on Power Pages. In this post I’m going to show you how you can allow people to upload an attachment using a basic form on a Power Pages site!
How things will work
This solution will basically let you create a new record on a Dataverse table and then the file uploaded on the submission form will arrive on the records timeline as an attachment.
The form and some advanced settings
So, from within Power Pages, I’m going to edit my site and navigate to the page which already has my basic form on against my table. My table is an issue table.
Select edit form on the form you’ve added to your page. Then in the data tab, select open portal management app to get to advanced settings.
Now you’ll see your form open in the Portal Management app for your environment! From here we’ll want to make some changes under the ‘additional settings’ tab.
Under the add attach file section, turn on the option for Attach File and set where you want to store files. Then you can add a label to display next to the upload button, set whether a file is required or not to submit the form, and provide an error message for the cases where someone doesn’t attach a file.
Make sure you save your record and then head back to the Power Pages studio.
The rest of the steps in this article are based on choosing note attachment and notes as the file save location.
In Power Pages head to the set up tab and navigate to your sites table permissions. We need to ensure people have access to the annotation / Note table so people can create timeline records.
On the existing table permission for your form add a child permission by selecting the three dots and select add child permission.
Give your table permission a name and in the table select the note table, and then select a relationship. You’ll need to apply create, append and append to permissions as minimum for this to work as a new form.
Then ensure you’ve added roles as to whether only authenticated users or anonymous users should be able to use this for example.
From here, ensure you’ve saved your table permissions, head back to your page and put it in preview mode, then submit a form and watch the file attached appear on the timeline of the record also created by the form!
I hope this post helped you to get started with allowing users to upload attachments when submitting a form via a Power Pages site!