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

Iron 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