Custom list form: save and keep editing - how?

MVP

Hello,

 

When I create a new list item and save it, I would like to keep the list form open instead of closing it. I then want to show additional fields and a button that will trigger a workflow. The workflow needs to know the list item ID, because it will write a status back into the list item.

 

I currently use a flow that is triggered when the item is created, but it can take up to five minutes for the flow to run. If I use a flow button in the custom form, it would run immediately. But I can't tell the flow button what the ID of the item is, unless it has been saved. 

 

How can I keep the form open and the current item showing after a new item has been submitted? 

I currently have

 

SharePointIntegration OnNew =Set(MyVar,"new"); NewForm(SharePointForm1)

SharePointIntegration OnEdit Set(MyVar,"edit"); EditForm(SharePointForm1)

 

SharePointForm1 OnSuccess =If(MyVar="edit",ResetForm(SharePointForm1); RequestHide(),Set(MyVar,"edit"))

SharePointForm1 Item =If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),SharePointForm1.LastSubmit,SharePointIntegration.Selected)

 

I have a label on the form that uses SharePointForm1.LastSubmit.Title. When I save a new item, that label shows the correct title, but the other fields in the form show a previously entered item, not the last one. 

 

Ideas?

 

 

 

3 Replies
You will probably have to use a Flow to add the item instead of the default save and return the ID to your form to store and then don't call RequestHide. If the user clicks the save again, pass the ID to your Flow and do an update instead. This will mean you can't have attachments unless you use a separate Flow to add them as we used to before it was supported in the form.
Another might be to simulate what happens when you edit by getting the last item added by the current user to get the ID and use that to populate the form fields on the edit form but no idea if that would work.

Thanks @Alan Marshall , I think I found another workaround that does not required editing after the new item is saved. 

@Ingeborg Hawighorst I found out that you need to remove the "OnSuccess" field's default functions RequestHide and ResetForm. On top of this you need to update the "Item" field's default function from First("DataSource") to Last("DataSource"). This will ensure that the last saved item's values will remain instead of reverting to the first item's values. I'm not sure why it becomes blank or empty when saving even after changing the "OnSuccess" field to just be false (do nothing), but that is what happens. Hope this helps!