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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need help writing an e...
Power Automate
Answered

Need help writing an expression to add to and format a number.

(0) ShareShare
ReportReport
Posted on by 25

Hello,

I have a flow that autogenerates ticket numbers in the format we want. An example of the format is 22322. I was able to change the format to start with 23 for the new year but I don't seem to be able to figure out how to make my number start at 1 for the new year (23001). I would like to add -314 to the number but it gives me an error when I try to use the add function. I will need to manipulate the format of the 'ID' and add a number to it every January 1st in order to make the LIS Ticket # start at 23001, 24001 and so on but I don't know how to write the expression to do it. Can anyone help me with this? 

I think one of the issue is that the column 'LIS Ticket #' is built as a text line and we can default the word 'generating...' while waiting for the flow to run and generate the number. I suspect this is why I cannot seem to get the 'add' function to work. The expression probably needs to change the data type to an integer but I can't get it to work!

 

This is the expression in the LIS Ticket # field in the action 'Update Item' below

formatNumber(triggerOutputs()?['body/ID'],'23000')

 

RUSLO_0-1673009487874.png

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,801 Most Valuable Professional on at

    Hi @RUSLO,

     

    You can use a utcNow with the yy format. This way every year you get the correct starting number (23, 24, etc).

     

    You can convert that yy string value to a number with an int function. After that you can mul(tiply) that number by a 1000. And as a last action you can add the ID field number to it.

     

    Below is an example

     

    add(mul(int(utcNow('yy')), 1000), triggerOutputs()?['body/ID'])

     

    listicketnumber.PNG

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 308

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 226 Most Valuable Professional

Last 30 days Overall leaderboard