web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Auto-Assign a Project ...
Power Automate
Answered

Auto-Assign a Project ID Number + Year

(0) ShareShare
ReportReport
Posted on by 11

Hey Everyone, 

 

I'm hoping that someone here can assist. I intend to create a flow that auto-adds a project ID number to an item on my Sharepoint / Microsoft List. 

 

I found this piece of code that helps to create the project ID number (it pulls the form ID number and formats it into the 5-digit number).

 

add(triggerBody()?['ID'],00000)

 

I want to add onto this and format it the project ID number in the following way: 

 

YY-00000

Example: 22-00001

 

The 22 is the year. So, I would switch this January 1st every year to update the numbers. 

 

I'm certain this is a super easy fix, I just don't know coding well enough to figure out what I need to do.

 

Thank you in advance!

Categories:
I have the same question (0)
  • schwibach Profile Picture
    2 Moderator on at

    The expression formatdatetime(utcnow(),'yy') will give you the current year. 

     

    You can use the concat expression to join those two strings together.

    You can do it 😉

  • Verified answer
    cadams Profile Picture
    11 on at

    I have it working, but it is removing the 00's from the Project ID number formatting, like above. Here is the code: 

     

    concat(formatdatetime(utcnow(),'yy'), '-', add(triggerBody()?['ID'],00000))
     
    It is producing this: 
     
    22-28
    versus
    22-00028

    Do you see anything I did wrong above? 
  • schwibach Profile Picture
    2 Moderator on at

    The add funcion does nothing as it only adds zeros, but the value does not change.

     

    You can use the Format Number action on the result of your expression add(triggerBody()?['ID'],00000)

     

    And then concatenate.

  • cadams Profile Picture
    11 on at

    I'm new to power automate, couldn't get this to work out so I opted to just manually put in this code: 

     

    add(triggerBody()?['ID'],22000)

     

    Hopefully I don't go over 999 projects next year lol.

  • schwibach Profile Picture
    2 Moderator on at

    Well, as long as it works, that's what counts.

  • v-liwei-msft Profile Picture
    on at

    Hi @cadams 

     

    I totally agree with @schwibach that using the Format number action is absolutely correct (I just made a little addition and test)

    vliweimsft_0-1667371464856.jpeg

    vliweimsft_2-1667371575440.jpeg

     

     

    Best Regards,

    Levi


    You can change the ID to 00000 format and connect UtcNow('yy') with the Concat function.

  • cadams Profile Picture
    11 on at

    Thanks for breaking this down and providing screenshots and the code. - I'm not certain how to set this up at this point. I keep receiving an error because it obviously is setup incorrectly. Here is what I currently have: 

     

    This is the full flow

    cadams_0-1667396130266.png

     

    This is showing the Update Item Settings

    cadams_1-1667396168669.png

    Then I have the Format Number and Compose like you have on your reply

    cadams_2-1667396220694.png

     

    In theory, I'm looking for this flow to pull the ID number (auto-assigned via Microsoft Forms), and format it how I have my original statement. I'm not sure how to update this from what's been provided. 

     

    What would simplify this even more is if I could somehow get this to work off my flow connector for Forms to feed into Microsoft Lists. Not sure if that's possible, but again, I'm not sure how to pull the Microsoft assigned ID and get everything working correctly. The above causes a flow error.

     

  • v-liwei-msft Profile Picture
    on at

    Hi @cadams 

     

    You should put get item under Compose so you can get the result returned by Compose.

     

    Best Regards,

    Levi

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard