cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
petewalburn
Frequent Visitor

Creating unique ID

Hi,

 

I have a sharepoint list where one field starts with the year followed by a '-' and then an incremental number. So it has values like:

2021-0001

2021-0002

.

.

.

2022-0001

2022-0002

2022-0003

 

I could like to be able to create the next unique value for the current year.  I can do this with PowerApps, but would like to have a function within Power Automate that I can call from PowerApps to get the next value.

 

So, I was thinking that I could do this with the 'Get Items' action, supplying the Site Address and List Name. I would like to include a Filter Query entry to only return the items where the ID starts with the current year.  If, I Order this query in descending order, then the first record will be the maximum current value.  Then if I increment his value by 1, I should get a new unique value.

 

However, I am having trouble adding the Filter Query value.  I have tried:

 

startsWith('FNCR Number',formatDateTime(utcNow(),'yyyy'))

 

There is an error with this:

Column 'False' does not exist. It may have been deleted by another user.
clientRequestId: 780e1cc9-3bb1-45a8-a5e5-00ad9d94c942
serviceRequestId: 780e1cc9-3bb1-45a8-a5e5-00ad9d94c942

 

Any help is much appreciated.

 

Pete

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Slowpoke
Resolver II
Resolver II

I used substringof instead, and it works. Maybe use this:

Slowpoke_0-1660142248741.png


And maybe you have to check in the sharepoint list parameter that it is the good column name, as sometimes the one that is displayed isn't the one that is used by Power Automate

 

 

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

9 REPLIES 9
Slowpoke
Resolver II
Resolver II

First, I think that you should write:

startswith(FNCR Number,'formatDateTime(utcNow(),'yyyy')')




I just get 'The expression is invalid' for that!

 

 

Slowpoke
Resolver II
Resolver II

Can you send a screenshot of your flow?

petewalburn
Frequent Visitor

petewalburn_0-1660139185065.png

 

The Filter Query is:

startswith('FNCR Number',formatDateTime(utcNow(),'yyyy'))
 
I did have the code you'd sent, but changed it back to the above.
 
Pete
Slowpoke
Resolver II
Resolver II

Ok, I'm not sure, but maybe should write it not as a function, but more like this:

 

Slowpoke_0-1660139706510.png

Or a variant like this:

Slowpoke_1-1660139785846.png

 

petewalburn
Frequent Visitor

OK, tried that and got:

 

The function operator 'startsWith' is not supported or its usage is invalid.
clientRequestId: 0d313d32-02f8-4585-adb7-4128606918b1
serviceRequestId: 0d313d32-02f8-4585-adb7-4128606918b1

 

Slowpoke
Resolver II
Resolver II

I used substringof instead, and it works. Maybe use this:

Slowpoke_0-1660142248741.png


And maybe you have to check in the sharepoint list parameter that it is the good column name, as sometimes the one that is displayed isn't the one that is used by Power Automate

 

 

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

petewalburn
Frequent Visitor

No, can't get this to work.

 

I'll have to keep trying tomorrow!

 

Thanks for your help!

 

Pete

Hi,

 

Kept trying this and got it working in the end.

 

I used substringof().

 

Thanks very much 

 

Pete

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,281)