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

Form not refreshing upon submit

I’m running into an issue where my Edit Details form is not refreshing with new data once the form is saved. It is saving the data to my SharePoint list and if I navigate away from the page and back again the form shows the updated data. Here’s the background:

  1. On my gallery OnSelect property, I set a variable (varRecord) to ThisItem like this:

Set(varRecord,ThisItem); Navigate('Request Details Screen', ScreenTransition.None)

 

  1. On the Request Details screen I have an Edit form with the Item property set to varRecord
  2. On the Request Details screen, I have an Edit button that sets a variable called v_EditOn to true to change the form mode to edit.

Set(v_EditOn, true)

 

  1. The Save button OnSelect property is set to:

Patch('Spend Request',{ID:varRecord.ID},frm_ReqDetails.Updates); Set(v_EditOn, false); Refresh('Spend Request')

 

  1. The form’s OnSuccess property is set to: Refresh('Spend Request').

 

I also tried adding ResetForm(frm_ReqDetails) in the form OnSuccess and on the Save button…but no luck there.

 

I’ve read several posts where others were having the same issue, but I can’t seem to resolve this. I saw the suggestion to use Gallery.Selected instead of using the variable but I don’t think that’s an option for me. The reason I’m using varRecord is because I’m also using deep-links and accessing the detail screen from multiple different galleries.

 

Does anyone have any other suggestions for how to fix this?

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

Hi @tsparkman 

Thanks for the info.

On the screen containing the gallery:
There should be on an icon Inside the gallery like a ">" icon" with its OnSelect property

 

Set(varRecord,ThisItem);
EditForm(frm_ReqDetails);
Navigate('Request Details Screen', ScreenTransition.None)

 

to edit the record chosen in the gallery existing records.

 

There should be an icon Outside the gallery for a New record, like a "+" icon with its OnSelect property

 

NewForm(frm_ReqDetails);
Navigate('Request Details Screen', ScreenTransition.None)

 

to open the form in New mode to accept new records.

 

On the 'Request Details Screen'

The Datasource of the form should be 'Spend Request', 
The Item property of the form should be 

 

Lookup('Spend Request', ID = varRecord.ID)

 

Get rid of the edit button, it is implicit in the icons inside and outside of the gallery.  There is no need for a patch and there doesn't appear to be a SubmitForm() function on your 'Request Details Screen'; the form's OnSuccess property will not fire without it. The Save button should have its OnSelect property 

 

SubmitForm(frm_ReqDetails)

 

instead of the Patch. 

 

The OnSuccess property of the form should have:
Back() or to Navigate to another screen of your choice, perhaps a "Success" screen to let the user know the submission succeeded.  I like

Notify("Your data was successfully submitted", Success);
Back()

 

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

Hi @tsparkman 

I need a little more information before making a suggestion.  There is some missing information:

  • Is your gallery named 'Spend Request' or is that the name of your datasource?
  • What is the items property of the gallery? Please post the exact formula.
  • Is the Items property a collection or a datasource? 
  • Is your datasource in Excel, SharePoint, CDS or SQL?

Hi @Drrickryp -

 

Thanks for your quick response and your willingness to help! Below are answers to your questions:

 

  • Is your gallery named 'Spend Request' or is that the name of your datasource? Spend Request is the name of my data source.
  • What is the items property of the gallery? Please post the exact formula. The Items property of the gallery is as shown below:

Filter(
SortByColumns(
Search(
'Spend Request',
input_Search.Text,
"RefNum",
"Title"
),
varSortBy,
If(
varSortOrder,
Ascending,
Descending
)
),
'Created By'.Email = gbl_User
)

  • Is the Items property a collection or a datasource? The items property is a data source, not a collection.
  • Is your datasource in Excel, SharePoint, CDS or SQL? The data source is a SharePoint list.
Drrickryp
Super User
Super User

Hi @tsparkman 

Thanks for the info.

On the screen containing the gallery:
There should be on an icon Inside the gallery like a ">" icon" with its OnSelect property

 

Set(varRecord,ThisItem);
EditForm(frm_ReqDetails);
Navigate('Request Details Screen', ScreenTransition.None)

 

to edit the record chosen in the gallery existing records.

 

There should be an icon Outside the gallery for a New record, like a "+" icon with its OnSelect property

 

NewForm(frm_ReqDetails);
Navigate('Request Details Screen', ScreenTransition.None)

 

to open the form in New mode to accept new records.

 

On the 'Request Details Screen'

The Datasource of the form should be 'Spend Request', 
The Item property of the form should be 

 

Lookup('Spend Request', ID = varRecord.ID)

 

Get rid of the edit button, it is implicit in the icons inside and outside of the gallery.  There is no need for a patch and there doesn't appear to be a SubmitForm() function on your 'Request Details Screen'; the form's OnSuccess property will not fire without it. The Save button should have its OnSelect property 

 

SubmitForm(frm_ReqDetails)

 

instead of the Patch. 

 

The OnSuccess property of the form should have:
Back() or to Navigate to another screen of your choice, perhaps a "Success" screen to let the user know the submission succeeded.  I like

Notify("Your data was successfully submitted", Success);
Back()

 

View solution in original post

Hi @Drrickryp - Apologies that I am just now responding. I got pulled into another project last week and just now had a chance to try this out. Your solution worked perfectly! 

 

Thank you so much!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,610)