cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TorreyFalconer
Helper IV
Helper IV

Unique ID (sharepoint list) BEFORE submit

Hey all, 

 

Super frustrated here. Basically I need a unique ID number to be created when someone starts a new form. My data source is a sharepoint list and so I was hoping to use the "ID" column for this feature as it does give you a unique ID for every new entry. The problem is that it only generates the ID after you click submit and I need it to display the ID beforehand. 

 

Currently I have the text property of the datacard "ID" set to If('Form3-table2'=New, Last('CompanyName- Incident Reports').ID+1, Parent.Default), however that doesn't seem to be working, even though I do have previous entries in that list so it should be able to calculate the next ID. 

 

I also tried making a second column in the Sharepoint List with a calculated column to copy the ID column with the formula [ID], but as soon as an entry it completed then that column changes to =ID and stops copying the ID column. 

 

Basically all I require is upon opening a new form, that form to auto-calculate a unique number that is from a Sharepoint list. Someone please help me! Thank you!

18 REPLIES 18

you may need to call refresh on the data source to see the new entry.

@geneZebra no refreshing did not work

I found in some cases, I need to wait before the data is shown after a patch. Maybe that is what is going on here. if you open the list outside of the app does it show up? 

@geneZebra 

 

It does not. That is what I was checking earlier. It does not show up.

hmm... if Form1'.LastSubmit.ID has the value then it must be in list. I don't think  it would be set on a failure. 

 

I could see it possibly being cleared in the app if somehow another submit interferes with it.  To debug this, try setting the value of Form1'.LastSubmit.ID to variable and then displaying both the variable and the "Form1'.LastSubmit.ID" on a temp text control on the same screen as the form. If one goes away, it could be you need to use a variable in the new form. 

 

curious what you see.

Yeah, I would have the OnSuccess of the first form do something like:

Set(LastID, Form1.LastSubmit.ID)

Then, have it use that LastID variable in a separate field in the second list (maybe IncidentRefID?)

 

What value are you currently seeing submitted when you post? When you say the ID doesn't appear - do you mean the entry is created in the list but you don't see the IncidentRefID field filled, or do you mean that you don't see it within the App after submitting?

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat 

 

Ok thanks. Those first two things you suggested seem to work ok, that is how I had it working already. But ya, the issue is after I submit the form, that ID doesn't show up in the IncidentRefID field in the browse gallery, nor does it submit to the actual sharepoint list.

I thought I would chime in...I had the same issue.  My fix was pretty plain...

I created a list  "Index" in SharePoint with Title Column only.   That column I give my Unique ID number.  Then I hide that list from all to see and never look at it again FOREVER.

In powerapps....when you want to open your form, run something like this...

Set(varWorksheetID, First(Filter(Index,Title = "WorksheetID")).Index);Patch(Index,First(Filter(Index,Title = "WorksheetID")),{Index: Value(varWorksheetID)+1});Navigate(NewDailyWorksheetScreen)

 

 

any way...hope that helps. 

View solution in original post

Hi this Solutions is indeed, but i just want to know why does Generating and ID takes a lot of time? like my record is updated in a second but the ID filed is still empty as im using the Sharepoint list ID filed. do you know why ?

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,836)