I have a form which the user fills out and then a button which patches the info to a sharepoint list.
In sharepoint when a new item is created it is given a unique 'ID'. I want to pull this back to into the form so that after the first submit, the ID is on the form. Currently, it will only populate if i navigate away and then back again. Resetform or newform dont work as the default item is the gallery selection which of course wont be a newly created item.
I want to use a patch and not a submit form as not all fields should send data on first submit.
After the submission of a new item via SubmitForm, you can access the ID property for the SharePoint in the OnSuccess action of the form, via the LastSubmit property. You would have something along the lines of this expression in the OnSuccess property (assuming the form control name is 'EditForm1'):
Ah, got it. If you are using Patch, then you can use the return value of that function to retrieve the id of the newly inserted item. For example, this code would set the NewId variable from the result of the Patch: