0

I need to generate an id when an item is added in my custom list. I wanna try to use a workflow 2010 in sharepoint designer.

i have to add x zero before the id sharepoint. For example i add an item and id is 3 my workflow variable should become 00003

How can i achieve this?

0

following solution worked for me: https://www.linkedin.com/groups/Auto-Incrementing-Document-IDs-Help-43166.S.196916024

After I tried all kinds of formula's, solution turned out to be much easier, say: plain simple.

Solution from the link above:

If you need the leading 0s and I understand what you're looking for correctly, I think it can be accomplished with three SharePoint Designer workflow actions and using the ID field on the document library: -Create a column that will be your DocId and set it as type "single line of text"

You'll want to modify that column in the Content Type definition to be of type Hidden so that users can't modify this column when editing properties of a document in the library.

  • Create a SPD workflow and add a "Set Workflow Variable" action. Create a new variable "TempDocId" and when you set the value select the ... button and then type in 0000000 then press the "Add or Change Lookup" and insert a reference to the ID column of the current item. This gives you a variable that has the unique ID plus (too many) 0s in front of it

  • Next add the "Extract substring from end of string" workflow action. Change the number 0 to 6 and change the text "string" to be a reference to the workflow variable we created above "TempDocId".

  • Finally add a "Set Field in Current Item" workflow action and set the current item's DocId field to the value that's in the "substring" workflow variable (result from above).

How do I add leading zeros to a variable in Sharepoint 2010 site workflow?

1
  • Great your solution seems to be good. i'll try this tomorrow at work. Thanks – user1898765 Oct 22 '15 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.