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

Saving without returning to gallery now loads different item

I have a powerapp that uses a SharePoint list as its source. It uses a gallery to list the items and then clicking into it allows you to edit the form. It uses an autosave and regular save function that is supposed to allow the user to save it without leaving the form. However, after an update the other day related to gallery list sorting, the app will now load the first item in the gallery list instead of the current item which causes it to "blink" upon the save and display data from another item. The save function is a simple SubmitForm(Form1); function.

 

The update I made was to be able to filter the gallery for only items modified in the last 2 weeks. Powerapps is giving me a "delegation warning" but as my list has fewer than 1000 items, I assumed (maybe wrongly) that it wouldn't be an issue yet. The formula for the gallery's Item data is:

 

If(recentonly,


(Switch(Dropdown1.Selected.Value,

 

"Date",SortByColumns(Filter('Router Job Tracking',Modified>Today()-14),"Date",If(SortDescending1, Descending, Ascending),"Date",Descending),

 

"Work Order",SortByColumns(Filter('Router Job Tracking',Modified>Today()-14),"Title",If(SortDescending1, Descending, Ascending),"Date",Descending),

 

"Status",SortByColumns(Filter('Router Job Tracking',Modified>Today()-14),"Hide_x0020_OK",If(SortDescending1, Descending, Ascending),"Project_x0020_Name",Ascending),

 

"Modified",SortByColumns(Filter('Router Job Tracking',Modified>Today()-14),"Modified",If(SortDescending1, Ascending, Descending)))),

 

(Switch(Dropdown1.Selected.Value,

 

"Date",SortByColumns('Router Job Tracking',"Date",If(SortDescending1, Descending, Ascending),"Date",Descending),

 

"Work Order",SortByColumns('Router Job Tracking',"Title",If(SortDescending1, Descending, Ascending),"Date",Descending),

 

"Status",SortByColumns('Router Job Tracking',"Hide_x0020_OK",If(SortDescending1, Descending, Ascending),"Project_x0020_Name",Ascending),

 

"Modified",SortByColumns('Router Job Tracking',"Modified",If(SortDescending1, Ascending, Descending)))))

 

Is there a new way to save a form without exiting the form edit screen as well as prevent the loading of a different item? Maybe the Item formula is not correct?

2 REPLIES 2
Community Support Team
Community Support Team

Re: Saving without returning to gallery now loads different item

Hi @geoff_y ,

Do you want to save the form data without exiting the form edit screen?

 

Based on the needs that you mentioned, I think the Patch function could achieve your needs. Within your Edit screen, please set the OnSelect property of the "Submit" button to following:

If(
    EditForm1.Mode = FormMode.New,
    Patch(                                    /* <-- Add new reocrd */
               'YourSPList',
                Defautls('YourSPList'),
                EditForm1.Updates
    ),
     Patch(                                  /* <-- Update existing record */
               'YourSPList',
                BrowseGallery1.Selected,
                EditForm1.Updates
     )
)

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

 

More details about Patch function, please check the following article:

Patch function

 

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.
geoff_y
Level: Powered On

Re: Saving without returning to gallery now loads different item

@v-xida-msft  thanks for your reply. I added substituted the my prevoius Submit function with the Patch function on my edit screen's save button in the OnSelect field:

 

Patch('Router Job Tracking',Gallery1.Selected,Form2_1.Updates);

However, this did not solve my issue.

 

I have found that when recentonly is false, only sorting by "Modified" will keep the proper record after Patch. All other sorting options will result in the record changing (blinking) after the save.

 

Also, when recentonly is true, only sorting by "Work Order", "Status", or "Date" will keep the proper record after Patch. The "Modified" sorting option will result in the record changing after the save.

 

I assume it has to do with the "delegation warning" I have. Note that i have 292 records currently in the SPO list.

delegation warning.png

 

 

 

Again the code for this gallery sort is:

 

If(recentonly,   /* variable for checkbox to show recently only */
(Switch(Dropdown1.Selected.Value,    /* switch statement for true case of recent only*/

"Date",SortByColumns(Filter('Router Job Tracking',Modified>(Today()-14)),"Date",If(SortDescending1, Descending, Ascending),"Date",Descending),

"Work Order",SortByColumns(Filter('Router Job Tracking',Modified>(Today()-14)),"Title",If(SortDescending1, Descending, Ascending),"Date",Descending),

"Status",SortByColumns(Filter('Router Job Tracking',Modified>(Today()-14)),"Hide_x0020_OK",If(SortDescending1, Descending, Ascending),"Project_x0020_Name",Ascending),

"Modified",SortByColumns(Filter('Router Job Tracking',Modified>(Today()-14)),"Modified",If(SortDescending1, Ascending, Descending)))),

(Switch(Dropdown1.Selected.Value,  /*switch statement for false case */

"Date",SortByColumns('Router Job Tracking',"Date",If(SortDescending1, Descending, Ascending),"Date",Descending),

"Work Order",SortByColumns('Router Job Tracking',"Title",If(SortDescending1, Descending, Ascending),"Date",Descending),

"Status",SortByColumns('Router Job Tracking',"Hide_x0020_OK",If(SortDescending1, Descending, Ascending),"Project_x0020_Name",Ascending),

"Modified",SortByColumns('Router Job Tracking',"Modified",If(SortDescending1, Ascending, Descending)))))

 

 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 178 members 5,422 guests
Recent signins:
Please welcome our newest community members: