cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,580)