A different approach to a multi-screen form

The other day, I was experiencing an issue with the “SharePoint list attachment” control, which made me think about a work-around.

The issue I faced was that the control did not work for new items but worked perfectly for existing items. My work-around would therefore comprise of two screens, a first screen for adding all metadata except the attachments, and a second screen to add the attachments.

The “SharePoint list attachment” control only works in a form in edit mode, so I needed 2 form controls, one on each screen.

This was not difficult to accomplish. I just had to duplicate the screen with the editform. The trick was in letting the second editform know which item to use. I found out that this is possible when configuring the property OnSuccess of the first editform to something like:

EditForm(EditForm2);
Navigate(EditForm2, ScreenTransition.None, {newItem: EditForm1.LastSubmit})

and then set the property Item of the second editform to:

newItem

and then change the property OnSuccess of the second editform to something like:

Navigate(BrowseScreen1, ScreenTransition.None)

So the trick is to use LastSubmit as the item for the second screen.

I do not experience any issues with the “SharePoint list attachment” control anymore but I think it is still a nice trick to have on my sleeve.

This approach adds an item and updates it too which can have influence on versioning and Flow runs.

Leave a Reply

Your email address will not be published. Required fields are marked *