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')
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'])