How can I refresh gallery and form(with the top Gallery ID ) after submitting a form

%3CLINGO-SUB%20id%3D%22lingo-sub-2591235%22%20slang%3D%22en-US%22%3EHow%20can%20I%20refresh%20gallery%20and%20form(with%20the%20top%20Gallery%20ID%20)%20after%20submitting%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2591235%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3CBR%20%2F%3EThis%20might%20be%20any%20easy%20one%20for%20the%20powerapps%20gurus%20but%20can't%20figure%20it%20out%3CBR%20%2F%3EI%20have%20a%20gallery%20and%20a%20form%20.%3CBR%20%2F%3EWhen%20i%20click%20on%20an%20item%20in%20the%20gallery%20i%20pass%20the%20id%20of%20the%20gallery%20by%20doing%20the%20below%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EGallery%20onselect%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3ENavigate(%5B%40Form1%5D%2CScreenTransition.None%2C%7BselectedItem%3A%20Gallery1_1.Selected%7D)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20it%20works%20as%20expected.%3C%2FP%3E%3CP%3EOn%20the%20form%20item%20property%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3EIf(%0A%20%20%20%20IsBlank(selectedItem)%2C%0A%20%20%20%20Last(%0A%20%20%20%20%20%20%20%20Filter(%0A%20%20%20%20%20%20%20%20%20%20%20%20Sort(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'Log'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Sent%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Descending%0A%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Status.Value%20%3D%20%22Pending%22%20And%20Person.Email%20%3D%20User().Email%0A%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20)%2C%0A%20%20%20%20selectedItem%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20issue%20i%20have%20is%20i%20have%20a%20submit%20button%3CBR%20%2F%3Ewhich%20onselect%20properties%20i%20just%20use%20Submit(Form1)%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EBut%20after%20submitting%20the%20item%20disappears%20off%20the%20gallery%20which%20is%20good%20as%20the%20status%20of%20the%20item%20has%20changed%20but%3CBR%20%2F%3Ethe%20Form%20doesn't%20refresh%20with%20the%20top%20most%20item%20in%20the%20gallery%20with%20the%20highest%20id.%3C%2FP%3E%3CP%3EThe%20reason%20i%20think%20is%20the%20selecteditem%20is%20still%20blank%20until%20i%20select%20the%20gallery%20(If%20i%20do%20it%20filters%20and%20works)%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EWhat%20would%20i%20need%20to%20do%20to%20let%20it%20to%20refresh%20the%20gallery%20and%20form%20and%20how%20do%20i%20get%20the%20last%20id%20from%20the%20gallery%20without%20manually%20selecting%20it%20so%20it%20can%20filter%20the%20form%20as%20soon%20as%20i%20submit%20the%20form.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20it%20makes%20sense%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2591235%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Frequent Contributor

Hi All,
This might be any easy one for the powerapps gurus but can't figure it out
I have a gallery and a form .
When i click on an item in the gallery i pass the id of the gallery by doing the below


Gallery onselect

 

Navigate([@Form1],ScreenTransition.None,{selectedItem: Gallery1_1.Selected});

 

 

and it works as expected.

On the form item property

 

If(
    IsBlank(selectedItem),
    Last(
        Filter(
            Sort(
                'Log',
                Sent,
                Descending
            ),
            Status.Value = "Pending" And Person.Email = User().Email
            
        )
    ),
    selectedItem
)

 

The issue i have is i have a submit button
which onselect properties i just use Submit(Form1)

But after submitting the item disappears off the gallery which is good as the status of the item has changed but
the Form doesn't refresh with the top most item in the gallery with the highest id.

The reason i think is the selecteditem is still blank until i select the gallery (If i do it filters and works)

What would i need to do to let it to refresh the gallery and form and how do i get the last id from the gallery without manually selecting it so it can filter the form as soon as i submit the form.

 

Hope it makes sense 

1 Reply