cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CindyZ
Post Patron
Post Patron

Save Record and Stay on the Same Record

I've read lots of discussions on this but still don't feel I've found a clear answer.  

I would like to save my form and have it remain on that same form instead of going away.  Right now, the form has this in OnSuccess: ResetForm(OrderForm);RequestHide().  If I remove the RequestHide, it functions as I'd like -- EXCEPT -- when creating a NEW record.  

When I create a new record, it displays the very first record and not the one I just saved.  

 

Any thoughts on how to get it back to the just-saved record if a new record? 

 

Thanks in advance for your help and consideration.    

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @CindyZ ,

Do you want to remain the submitted form data within the Edit form when you create a new record?

Could you please show more details about the formula you typed within the Item property of the Edit form?

 

I have made a test on my side, please consider take a try with the following workaround:

Set the OnSuccess property of the SharePointForm1 to following:

Set(SubmittedRecord, OrderForm.LastSubmit);
ResetForm(OrderForm)

 

Set the Item property of the SharePointForm1 to following:

If(
   OrderForm.Mode = FormMode.Edit,
   If(
      !IsBlank(SubmittedRecord),
       SubmittedRecord,
       SharePointIntegration.Selected
   )
)

 

Set the DefaultMode property of the OrderForm to following:

FormMode.Edit

 

Set the OnNew property of SharePointIntegration to following:

Set(SubmittedRecord, Blank());
NewForm(OrderForm)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
PaulD1
Super User
Super User

Forms have a property: LastSubmitted. You can use that to see the details of the record you just saved.

You should then be able to use those details to set the Item property of the form and put the form into Edit mode, so after saving, you see the record you just saved in Edit mode in the form.

You may need to use to variables to store the LastSubmitted details and whether the the last submission was New or Edit.

v-xida-msft
Community Support
Community Support

Hi @CindyZ ,

Do you want to remain the submitted form data within the Edit form when you create a new record?

Could you please show more details about the formula you typed within the Item property of the Edit form?

 

I have made a test on my side, please consider take a try with the following workaround:

Set the OnSuccess property of the SharePointForm1 to following:

Set(SubmittedRecord, OrderForm.LastSubmit);
ResetForm(OrderForm)

 

Set the Item property of the SharePointForm1 to following:

If(
   OrderForm.Mode = FormMode.Edit,
   If(
      !IsBlank(SubmittedRecord),
       SubmittedRecord,
       SharePointIntegration.Selected
   )
)

 

Set the DefaultMode property of the OrderForm to following:

FormMode.Edit

 

Set the OnNew property of SharePointIntegration to following:

Set(SubmittedRecord, Blank());
NewForm(OrderForm)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

One issue with this process, although it works, the form cannot be opened and edited.  SharePoint opens the form and it just says "Getting your data" and never shows any fields.  Any idea how to solve this?  The rest of your process works well.

Eventually says this "An entry is required or has an invalid value. Please correct and try again."

This is the issue: If( SharePointForm1.Mode = FormMode.Edit, If( !IsBlank(SubmittedRecord), SubmittedRecord, SharePointIntegration.Selected ) )

 

When I go back and open the item it just says getting data and never opens.

 

 

While the default works, on save it bounces back to the previous record entered: If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First([@'Test List']),SharePointIntegration.Selected)

 

I'd like it to stay on the existing record I just saved.  Any way to modify the first statement to accomplish this?

I solved on my own by doing the following: If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),Last([@'Test List']),SharePointIntegration.Selected) That is the default statement in the form generates, however I change First to Last in the statement.  I opened several tabs with the same list and had saved multiple records, and each one remained on the existing record.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (49,177)