cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sfishe
Level: Powered On

Issue just today with saving an EditForm after selecting an item from a Gallery

I have an app that has been working fine for months now. Today I noticed it isn't saving new records properly. The configuration for this part of the app is a little complex: a gallery listing items, and a NewForm button, which leads to an EditForm page that just does a SubitForm() to save the data. However the edit form has OnSuccess() code that correctly stores the relational link/ID of the selected gallery item (a workaround I got from here to deal with linking SharePoint lists properly):

 

Patch('Exp Behaviour 2', Last('Exp Behaviour 2'), {Animal_rel0:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id:Gallery_Animals.Selected.ID, Value:Gallery_Animals.Selected.Title }} ));

Today when trying to save new entries the app isn't storing this linked value properly, after the first entry I make. So, for example, I made one new entry after selecting a gallery item, and that works fine. Then I select a different gallery item, go to the NewForm, put in data, save it, and now it saves the relevant/current Animal_rel value to the prior record in the SharePoint list - not the latest/relevant record, which is left blank. Therefore it seems like the Last() function used in the code above is not returning the actual last record saved, but the one before. However, it is strange that the first new entry I make today works fine (i.e. it is weird that it isn't also trying to save the Animal_rel value to the prior entry in the list).

 

Nothing has changed in my app recently so it must be due to a backend change on the MS end. Any ideas?

 

Edit: I realised this could be a '500 item limit' issue with SharePoint lists. The list ID is up to 552 but isn't contiguous, so the list is likely ~500 items big - I couldn't see how to get a count. How can I get around this in this case?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Issue just today with saving an EditForm after selecting an item from a Gallery

Hi @sfishe,

 

Instead of using the last () function, please take a try to switch to:

EditForm.LastSubmit

The whole formula should be:

Patch('Exp Behaviour 2', 
EditForm.LastSubmit, 
{Animal_rel0:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id:Gallery_Animals.Selected.ID, Value:Gallery_Animals.Selected.Title }} ));

Read more here:

"

LastSubmit – The last successfully submitted record, including any server generated fields.

  • This property applies only to the Edit form control.
  • If the data source automatically generates or calculates any fields, such as an ID field with a unique number, the LastSubmit property will have this new value after SubmitForm successfully runs.
  • The value of this property is available in the OnSuccess formula.

"

Reference.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

1 REPLY 1
Community Support Team
Community Support Team

Re: Issue just today with saving an EditForm after selecting an item from a Gallery

Hi @sfishe,

 

Instead of using the last () function, please take a try to switch to:

EditForm.LastSubmit

The whole formula should be:

Patch('Exp Behaviour 2', 
EditForm.LastSubmit, 
{Animal_rel0:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id:Gallery_Animals.Selected.ID, Value:Gallery_Animals.Selected.Title }} ));

Read more here:

"

LastSubmit – The last successfully submitted record, including any server generated fields.

  • This property applies only to the Edit form control.
  • If the data source automatically generates or calculates any fields, such as an ID field with a unique number, the LastSubmit property will have this new value after SubmitForm successfully runs.
  • The value of this property is available in the OnSuccess formula.

"

Reference.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,600)