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

Having a auto-increment field with PowerApps and SharePoint Online

Hi

I have a SharePoint list which, of course, has an ID field which I want to copy into another field, so I can use it.

 

As we all know using an ID field in a SharePoint List is a no-no.

 

So I want to replicate the old SharePoint Designer workflow which copies the value of the ID field into another field whioch I can use for other things eg. creating and unique Project ID Concat('PRJ', 005000,MyIDField)

 

Is there an easy way to do this ?

 

I can find lots of ways to do this using SQL Server, but not too many for SharePoint Lists.

 

I have tried the Get Items Flow Action, but the Filter does not want to work.  I keep getting '400' error messages saying the filter is invalid.

 

So there must be another way eg emulate the old SharePoint Designer workflow to copy the ID field.

 

Thanks

 

Nigel

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Having a auto-increment field with PowerApps and SharePoint Online

Hi @  NigelP,

 

 

Do you want to create a flow to save the ID field of the list in another field "MyIDField"?

 

I have made a test on my side, please refer to screenshot below to create the flow:

Capture.PNG

The flow would run successfully as below:

Capture.PNG

 

 

You said that you have tried the Get Items Flow Action, but the Filter does not want to work,and keep getting '400' error messages saying the filter is invalid. what are you want to filter from the items?Error 400 appears if a setting in an action of the flow doesn't function as expected. In this case, the error message contains Bad request or Not found.

You could refer to link below to learn more about troubleshooting the flow:

https://docs.microsoft.com/en-us/flow/fix-flow-failures

 

Please let me know if your problem could be solved.

 

 

 

Regards,
Alice Zhang

View solution in original post

11 REPLIES 11
Community Support Team
Community Support Team

Re: Having a auto-increment field with PowerApps and SharePoint Online

Hi @  NigelP,

 

 

Do you want to create a flow to save the ID field of the list in another field "MyIDField"?

 

I have made a test on my side, please refer to screenshot below to create the flow:

Capture.PNG

The flow would run successfully as below:

Capture.PNG

 

 

You said that you have tried the Get Items Flow Action, but the Filter does not want to work,and keep getting '400' error messages saying the filter is invalid. what are you want to filter from the items?Error 400 appears if a setting in an action of the flow doesn't function as expected. In this case, the error message contains Bad request or Not found.

You could refer to link below to learn more about troubleshooting the flow:

https://docs.microsoft.com/en-us/flow/fix-flow-failures

 

Please let me know if your problem could be solved.

 

 

 

Regards,
Alice Zhang

View solution in original post

bhrigu12
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

Do we need to fill all the fields in "Sharepoint-Update item" Flow or only the mandatory field i.e. Site address, List Name, Title, ID and MyIDfield...?

Like for example I ve 10 different fields, so do I need to assign all the 10 fields.

ThreeTen
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

Along with the mandatory items, only fill out the ones you want changed.

bhrigu12
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

Thnx for input..!!!

NigelP
Level 8

Re: Having a auto-increment field with PowerApps and SharePoint Online

Hi bhrigu12

 

You only need to fill in the mandatory ones.

 

The other fields are optional.

 

In my case I only filled in one field.

 

I filled in the rest later.

 

I hope this helps.

 

Regards

 

Nigel

bhrigu12
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

Thanx NigelP...!!!

bhrigu12
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

Just an update NigelP n Threetan....

 

If you have datafield having dropdown den you need to fill the fields even if its not mandatory..!!

Otherwise the sharepoint will get updated with default values...!!

 

Thnx for the help...!!! 

ThreeTen
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

That shouldn’t be intended behavior.
Highlighted
NigelP
Level 8

Re: Having a auto-increment field with PowerApps and SharePoint Online

Hi @v-yuazh-msft

 

I have conducted some more extensive testing on auto incrementing fields and have found the following :-

 

If Person A loads a PowerApps, the PowerApp connects to the SharePoint List and caches the list.

 

If Person B loads the same PowerApps, The PowerApp connects to the same SharePoint list and caches the list.

 

In both cases Last(SharePointList).ID give the same result.

 

If Person A then creates a new record and saves it, followed by Person B then Last(SharePointList).ID gives the same result as both instances of the PowerApps has cached the SharePointList..

 

This Results in the two records in SharePointList having the same Submission ID calculated from (Last(SharePointLIst).ID).

 

The only way I have found to prevent this double Submission ID is to put Refresh(SharePointList), just before the Last(SharePointList).ID.  Then everything then works.

 

So I suspect this may be a pitfall/bug  in PowerApps in that the Last(SharePointList) command does not actually get the last record at the time of the command, but the last one when the PowerApps was loaded and the SharePointList was cached..

 

Regards

 

Nigel

ThreeTen
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

That is because Last() is a non-delegated function.  Which means that, by and large, it uses the cache rather than the source.
However, Sort() is Delegated with sharepoint...so calling, say, a desc sort on the createdon column followed by a First() should do the trick to get the most recent id.

jpt1228
Level: Powered On

Re: Having a auto-increment field with PowerApps and SharePoint Online

Hello, I was able to re-create most of the flow. However when I get to the update item I can seletc the ID field in the Id field, but cannot select the ID to go into the updated field I want to return the ID field (MyIDField) as below.

 

no ID.JPG

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,125)