Hi @Saan ,
My apologies - I was really giving some guidance on how to approach things. I will now try to explain the logic.
Firstly, the code I gave returns the last record the current user has posted
FirstN(
Sort(
Filter(
'VendorList',
<UserEmail>=vEmail
),
ID,
Descending
)
)
This is the record the user saved last, however it returns a table with one record (the one you want) in it.
The other thing you need to do to avoid "Delegation" issues is to set a Variable for the User's email - this can be done at App start, but I will do it before the screen transition below.
The last bit is that the resulting record has to be in the Items property of the form with one more trick - because it is a table, you have to tell PowerApps which record to display. As you know there is only one, you use the first. So Putting it all together:
Your transition to the screen
Set(
vUserMail,User().Email
);
Navigate(
EditScreen,
ScreenTransition.None
)
Now the Items property of the form on the screen should be
First(
FirstN(
Sort(
Filter(
'VendorList',
'Created By'.Email = vUserMail
),
ID,
Descending
)
)
)
So to put some logic around this (you have to read formulas from the inside first):-
- You are filtering the Vendor List to show only records the current user has created
- You then sort that list by ID descending
- You then take the first record in this set (which of course is the last one written)
- You then send the table to the form and tell it to display the first record (as it will not display a table - that is what galleries are for)
If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.