cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AGS94
Level 8

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
v-siky-msft
Level 10

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
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."

 

 

PowerAddict
Level 10

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.

 

v-siky-msft
Level 10

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

AGS94
Level 8

Re: Retrieving Unique ID Upon Record Creation

 

 

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,818)