web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using lastRecord or La...
Power Apps
Answered

Using lastRecord or LastSubmit to create ID

(0) ShareShare
ReportReport
Posted on by 137

I have a canvas app linked to a sharepoint list.

 

I have a field/card called "PR ID" that is blank by default and isn't a text input.

Once a new record is saved, I would like the 'PR ID' field, to take the line ID (created automatically by sharepoint once submitted) and put a "4" in front of it.  So if a I saved a record, that had ID# '12345' then the 'PR ID' would save as '412345'.

 

I have tried using variations of lastRecord, LastSubmit, Patch, etc. and I just can't seem to get the syntax right.

I'm also curious as to where correct syntax should go, possibly OnSuccess in the edit form?

 

Any help or direction is appreciated.

 

thank you.

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @JeffT2022 could you try the following code in the submit button:

    SubmitForm(FormName); Patch(DataSource, FormName.LastSubmit , {'PR ID': 4 & FormName.LastSubmit.ID});


    If this solves your question, would you be so kind as to accept it as a solution.
    Thanks!

  • Verified answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @JeffT2022 ,

     

    Try to add a Patch() to the OnSuccess property of the Form, for example:

     

    Patch('DataSource',Form1.LastSubmit,{'PR ID': 4 & Form1.LastSubmit.ID})
  • JeffT2022 Profile Picture
    137 on at

    Both of these methods work, no issues - Thank you both!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard