1

I have a flow formula to Increment the number in a text field to populate the ProjectID value. The ProjectID field is formatted as such 'JEN0001'. My formula is passing value of 'JEN1' without the zeros. Anyone have any idea what might be off with my formula below?

UPPER(LEFT({!$Record.Account.Name}, 3)) & TEXT(VALUE(RIGHT({!varprojectId}, 4)) + 1)

1
  • I updated my formula so the zeros are showing UPPER(LEFT({!$Record.Account.Name}, 3)) & "000" + TEXT(VALUE(RIGHT({!varlatestProjectId}, 4)) + 1) My concern is once I hit JEN0010 all three zeros will still show. Anyone know how I can update the formula to dynamically update the leading zeros based on the value currently at?
    – jmorris007
    Commented Jul 23 at 18:40

2 Answers 2

2

This may sound simplistic, but what if you created an autonumber for the '0001' part then create a formula to concatenate them all together? I can imagine a dozen different ways that just doing +1 on a flow update would break. Salesforce already takes care of ensuring that it's counting +1 on each unique record and keeping the format that you want to use. So take advantage of it.

UPPER(LEFT({!$Record.Account.Name}, 3)) & {!$Record.AutoNumber__c}
0

The LPAD function does this for you:

LPAD(TEXT(VALUE(RIGHT({!varprojectId}, 4)) + 1),4,"0")

You could have also used RIGHT again:

RIGHT("0000" & TEXT(VALUE(RIGHT({!varprojectId}, 4)) + 1), 4)
1
  • The LPAD formula worked as expected! Thank you!
    – jmorris007
    Commented Jul 24 at 12:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .