1
votes

I have creating a handover form in PowerApps using a SharePoint list as data collection point, I would like when a new form is selected information from the last submitted form is auto populated into data card values.

e.g. if the last form has text in the 'Safety Information' DataCardValue then it should be copied into the new form, they also need to be able to edit the field if needed.

I have tried the following in the DataCard and the DataCardValue default sections.

If(!IsBlank(EditForm1.LastSubmit.ID), EditForm1.LastSubmit.'Safety Information',ThisItem.'Safety Information')

I would expect that just the DataCard 'Safety Information' (text field) to be populated with the last submitted data in that field but with the code it will set the form back to the last submit form. In the SharePoint list it will create a new row for the new form but no information has been copied across from the last form.

1

1 Answers

0
votes

It sounds like what you need to do is save the value you want before you call SubmitForm(). You can do this with code like:

Set(LastSavedTitle, DataCardValue5.Text); SubmitForm(EditForm1)

Then update the data card default value by doing something like:

If(EditForm1.Mode = FormMode.New, LastSavedTitle, ThisItem.Title)

In the above code, I default to using the last saved value only when the EditForm is in 'New' mode (versus 'Edit'). The above code is pretty rough and you'll probably want to tweak it even further for a smoother end to end experience.