To me this seems straight forward but I can not for the life of me figure out how to do this. I would like when a edit form is submitted it creates a new record. I had it set up that every time they edit the form it modifies the record. But now my team would like to change it to creating a new record every time the form is edited.
Back story.... I have developed an app that the teams can add/edit a resident based on their movement (transfer to hospital, discharge, admission, death, room transfer and so on). When I created the app I was not aware of the checks the teams have in place and they are now requesting that they see every movement a resident does. So when they search for a resident it will show every time they have been transfer to hospital, every leave of absence and so forth.
Ideally what I would like is the main screen where they search the resident and only one name comes up for that resident and then they can edit the form based on what is happening with the resident and then that would create a separate record from the original. So what I am envisioning is having two SharePoint lists one with list of resident and their information from the time of admission and then a second SharePoint list that has each record created for that resident. I want the teams to able to select a resident and the movement and just fill out the date and additional comments field. Everything else will populate based on the resident selected.
Hope this makes sense.
A form's mode is set with a function, either NewForm(Form1), EditForm(Form1) or ViewForm(Form1). This is often done by an icon in the gallery before opening the screen containing the form if EditForm is used or Outside the gallery, for a NewForm. The key properties of the form itself are its Datasource and the Item (record) that is being created or modified. In the case of a New record, only the Datasource is necessary. For modifying an existing record, then the Item property must be sufficient to clearly identify the record being changed.
A default mode can be set for the form, but this is overridden by the NewForm(), EditForm() or ViewForm() functions.
Yes I understand this. I already have it set up. The thing is now they want to be able all movement a resident does not just the most recent. The way I have currently setup is that the form is edited then it modifies the Sharepoint list instead of creating a new record. Instead of it modifying the record I need a new record to be created. I understand how the different types forms work I am just not sure how to pull a resident from the gallery, edit the form and submit it as a new record instead of modifying the record.
You need to consider whether you are dealing with a single list or if your list contains a One to Many relationship. I suppose that would depend on the information acquired Typically in my practice, (i'm a surgeon), I have a list for the patient demographics and a second list for encounters. They are linked using the ID in the Patient list to a field patientID in the encounters list. It is critical that the underlying design be correct or you will have a great deal of trouble keeping things straight as your lists grow. I suggest that you check out my series on database design and Powerapps here. https://powerusers.microsoft.com/t5/News-Announcements/Database-Design-Fundamentals-and-PowerApps-An...
The unfortunate part of the EditForm is that (as you know) it has three modes, Edit, New and View.
When in Edit, it will use the Item record specified in the Item property. When in New, it will use (internally) the Defaults of your datasource. So, you can't supply both and have it do what you are looking for.
There are two options:
1) Simple, but you lose the functionality of the Form (error checking, Lastsubmit, etc) and that is to have your form in Edit mode with the record you want to edit and then new. Instead of SubmitForm, you can use Patch(yourDataSource, Defaults(yourDataSource), yourForm.Updates)
This will create a new record with all the information in the form. Again, you lose the features of the submit, but will give you what you want.
2) Have your form in New mode, but capture the record you want in a snapshot variable. Then change ALL of the datacard default values to reference your variable instead of the ThisItem that it currently would reference.
This allows you to still use the form features, but it is a lot of work if you have a lot of fields in it.
I hope this is helpful for you.
Join us for the next call on August 17, 2022 at 8am PDT.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.