cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pavel_O
Frequent Visitor

Getting Last submitted SharePoint entry to a new EditForm

Hi, 

I'm trying to get the last entry submitted to SharePoint list to be displayed when editing same entry on a new editform so it could be edited and resubmitted. 

 

tried changing the default value of card to 

 

 

 

Last(SharepointLisName).ColumName

 

 

 

but seems it has no effect.

 

any help will be appreciated

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
KrishnaV
Super User III
Super User III

Hi @Pavel_O ,

 

I totally agree with @eka24 but I would say don't use Set because it is a global variable and its scope is as long as app running which will increase the app weight and decrease the performance (on a longer time). Rather I say user as below:

OnSuccess property of the FORM:
UpdateContext({varlastSubmittedID:Form1.LastSubmit});

Now set this varlastSubmittedID to the form item property. 

 

Again, @eka24 solution works seamlessly all I want is a change in variable scope to improve App performance


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

9 REPLIES 9
eka24
Super User III
Super User III

On the OnSuccess property of the Form example Form1 put:

Set(VarLastSubmit,Form1.LastSubmit)

 

Then in the Items property of the Form1 put: VarLastSubmit

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

KrishnaV
Super User III
Super User III

Hi @Pavel_O ,

 

I totally agree with @eka24 but I would say don't use Set because it is a global variable and its scope is as long as app running which will increase the app weight and decrease the performance (on a longer time). Rather I say user as below:

OnSuccess property of the FORM:
UpdateContext({varlastSubmittedID:Form1.LastSubmit});

Now set this varlastSubmittedID to the form item property. 

 

Again, @eka24 solution works seamlessly all I want is a change in variable scope to improve App performance


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Pavel_O
Frequent Visitor

thank you.

it works great for the current user session. 

is there way to get the item from another users session / 

sometimes the SharePoint list is updated directly not from the app.

 

Hi @Pavel_O ,

 

It is not possible to get the ID of the last submitted item if the user submits from SharePoint directly. What you can do is add a Microsoft flow with Item added event and perform the same operations from the flow that way you can achieve your needs. 

 

Power App can get the ID only if the user uses Power Apps, if not Flow is the best approach.

 

I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi @Pavel_O

Do you want to get the value of the field in the last modified record?

My method is to find out the last modified record through the standard field "modified".

Please try this code:

 

Last(Sort('SharepointLisName',Modified,Ascending)).ColumName

 

 Best Regards,

 Bof

In addition to the last Submit, to get the recent item use last.

Last ( Sort(Datasource, DateColumn, Ascending)).DateColumn

You can replace the DateColumn with an ID Column you have ID Column

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @Pavel_O ,

 

Let me ask you one quick question? why do you want to get the last ID created (externally) in Power App? if you want to use for any reference, you may use as 

UpdateContext({varLstSubID:Max(Sort(SampleList,Created,Descending),ID)})

Note : Max This is not a delegable function so it gives a delegation warning however Sort is delegable so you will get the latest ID in your app.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Pavel_O
Frequent Visitor

my scenario is one of the items in the sharepoint list is almost repeatable with minor changes when submitted.

i was looking for a way get the last submitted entry to be re-entered when editing the form in powerapps with no need to retype it again.

i was able to get it working while users submit it from powerapps.

the problem is that sometimes some of the users edit the form directly.

as you answered me before i understood there is no way to get the last submitted entry if it was edited not in powerapps.

thank you again for the help.

LGC
Regular Visitor

@Pavel_O 

Just curious but could you hide the SharePoint list from users and add browse gallery list for users to view/edit?

I am trying to build something similar that is why I'm asking. 

My goal is to have a main screen browse gallery with new option, going to a display or edit form. Once this form is saved I have a deep link that will send an email to a distribution list that links directly to the lasts submitted file. (my issue and reason for being here the deep link works great, last submitted not so much). 

Anyways I just thought I'd ask to see if I'm going to run into any new problems once I get this last submitted part to work)

Thanks

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

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