[✅ Solution] Formatted ID in calculation field

Just a short tip that some may find helpful following on from @tim’s post about calculation fields best practices, I don’t believe that the formatted ID field is available in a calculation field (it is in an automation) only the unformatted version, a way round this is to build the ID field:

// My ID number

const number = @ID;

// Format the number with leading zeros (assuming you want it to be a 3-digit number)

const formattedNumber = String(number).padStart(3, ‘0’);

“PRJ” + “” + formattedNumber + “ - “ + @Title

Tim will probably now tell me a way that you can get the formatted ID in a calculation field :wink:

2 Likes

Thanks for sharing, @Jason! This is very useful. :partying_face: And clean code :wink:

Indeed, the formatted version of the unique ID field is not available inside calculation fields. Feel free to create a feature request for that if it blocks any use cases.

Cheers
Tim