Auto generate custom ID with Prefix

%3CLINGO-SUB%20id%3D%22lingo-sub-2660946%22%20slang%3D%22en-US%22%3EAuto%20generate%20custom%20ID%20with%20Prefix%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2660946%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EWE%20have%20our%20default%20ID%20field%20in%20SP%20list.%20I%20want%20to%20use%20that%20field%20to%20create%20my%20own%20custom%20ID%20started%20with%20some%20text%20prefix%20with%200000%20added%20to%20the%20default%20ID.For%20ex-%20ODR0001..ODR0002...ODR0010...ODR0099...ODR0100...ODR1001....I%20created%20a%20WF%20having%20below%20steps%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LaxmikantB2_0-1629297689424.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304121i6B0230B1F394A708%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22LaxmikantB2_0-1629297689424.png%22%20alt%3D%22LaxmikantB2_0-1629297689424.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CBR%20%2F%3EIt%20working%20fine%20till%20two%20digit%20ID.%20But%20the%20only%20thing%20I%20am%20not%20sure%20about%20that%20for%20100th%20item%20will%20it%20be%20ODR0100%20or%20ODR00100.%20If%20I%20will%20get%20ODR00100%20then%20how%20to%20get%20correct%20one%20which%20will%20be%20ODR0100.%20Thanks%20in%20advance.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2660946%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

WE have our default ID field in SP list. I want to use that field to create my own custom ID started with some text prefix with 0000 added to the default ID.For ex- ODR0001..ODR0002...ODR0010...ODR0099...ODR0100...ODR1001....I created a WF having below steps:

LaxmikantB2_0-1629297689424.png

 


It working fine till two digit ID. But the only thing I am not sure about that for 100th item will it be ODR0100 or ODR00100. If I will get ODR00100 then how to get correct one which will be ODR0100. Thanks in advance.

1 Reply
I would create a couple variables, then get the length of the ID (use length function), then using the length of the ID, pad function to prefix the ID with zeros, and then append you ODR string. What will happen when the ID reaches 10,000?