cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

Retrieving Unique ID Upon Record Creation

 

Is there a way within PowerApps to retrieve a newly created record's unique id immediately upon creating that new record? I am using CDS as a data source.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Retrieving Unique ID Upon Record Creation

Hi @AGS94 ,

 

If you are using Patch function, you can try to use Set(Var_UID, Patch('Entity Name', Defaults('Entity Name'),{…}). 'Unique ID Field').

Not only can create a new record, it also save the Unique ID of the new-created record as a variable.

 

If you are using Form to submit the record, you can put Form1.LastSubmit.'Unique ID Field' to get Unique ID  of new-created record 

Annotation 2019-11-20 160032.png

Best regards,

Sik

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Retrieving Unique ID Upon Record Creation

@AGS94 

Are you using a form?  If yes, you can retrieve all properties of the last submitted record using LastSubmit like this

 

Form1.LastSubmit.ID

 

If you want some other field you can type in this partial code and see what comes up in the autocomplete

 

Form1.LastSubmit.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

Highlighted
Super User
Super User

Re: Retrieving Unique ID Upon Record Creation

Just to add to that, if you are using Patch, you can collect the patched record.

Collect(Record, Patch(datasource, defaults(datasource), ....)

Then you can use Record.ID to fetch the id.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)
Highlighted
Dual Super User
Dual Super User

Re: Retrieving Unique ID Upon Record Creation

@AGS94 

 

If using formcontrol

then 

FormName.LastSubmit.UnqiueIdColumnName

 

If using Patch then 

Set(VarReturn, Patch(...))

then VarReturn.Unqiuecolumnname

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

Highlighted
Community Support
Community Support

Re: Retrieving Unique ID Upon Record Creation

Hi @AGS94 ,

 

If you are using Patch function, you can try to use Set(Var_UID, Patch('Entity Name', Defaults('Entity Name'),{…}). 'Unique ID Field').

Not only can create a new record, it also save the Unique ID of the new-created record as a variable.

 

If you are using Form to submit the record, you can put Form1.LastSubmit.'Unique ID Field' to get Unique ID  of new-created record 

Annotation 2019-11-20 160032.png

Best regards,

Sik

View solution in original post

Highlighted
Resolver I
Resolver I

Re: Retrieving Unique ID Upon Record Creation

 

 

Thanks to everyone for your help. All responses were helpful!

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,837)