Autonumber for document numbering request list

Category: sharepoint 2010 customization


bubberz1 on Mon, 06 Aug 2012 13:40:32

We have a scenario where a user requests an "autonumber" for documents.

There is a field where they select the "document type" when adding a new item to the list, which is a lookup field (doc_type) held in another list call "Document_Types_Lookup".

The user could select one of up to 15 different document types when requesting a new item, and the autonumber should stay in sync with the document there is no loss in the next available number for that particular document type.  This is why I can't simply use the ID column and append that to the "doc_type" field in a workflow.

Let's say we have the following autonumbers already in the list:

If a user submits a request for a MATH document, the number they should get to use is DEMO-MATH-003.

If a user submits a request for a SCI document, the number they should get to use is DEMO-SCI-002.

I have already used the autonumber in a workflow simply putting the ID column on the end, but this won't stay in sync with the particular doc type.

Thank you for any ideas!


romeo donca on Mon, 06 Aug 2012 14:47:34


in the workflow corelate the next new_id based item type to another list where you will have the current new_id values for each types of items from first list

( this mean, in the workflow, when an item is added, will look for the type of the item, will locate in a separate list an item with same type, and for that iotem will get the new-Id value

Nesxt step, will generate the col for id ( as you said DEMO_MATH_new-id-for-math-type )

and will update also the item in listB with new-item-for-math-type+1 )

Hope this make sense

Let me know it you need more infos

bubberz1 on Mon, 06 Aug 2012 14:57:12


Yes, need more clarification.

I have SharePoint Designer open, and am not sure what you are referring too about when you say:

"this mean, in the workflow, when an item is added, will look for the type of the item, will locate in a separate list an item with same type, and for that iotem will get the new-Id value"

Do I need to autopopulate another list with a set of available / pre-defined values?

Thank you!

romeo donca on Mon, 06 Aug 2012 16:38:31

Yes, it's right

a new list with an item for each type of document types. Each item will contain a starting pre-defined values, which will be incremented each time a new item is added in listA

bubberz1 on Mon, 06 Aug 2012 16:45:19


So, have a list with the following 3 columns and maybe the following rows as an example to start it off:

Long Description doc_type Starting Number
Mathmatics MATH 001
English and Literature ENG 001
Science and Technology SCI 001
Exercise and Lifestyle EXER 001

Is this what you mean?
I would be pulling off the "doc_type"column.

romeo donca on Mon, 06 Aug 2012 17:51:31


but let's rename Statrting_number = Current_number_ID

, this will be the listB, where Current_number_ID will be used to replace in listA new ID column ( as you described for ex DEMO-MATH-001 ), and which will be replaced with +1

Let say

that ListB after some time looks like

Long desc                                     doc_type      Current_number_ID

Mathematics                                  MATH             521

English                                           ENG              32

Science                                          SCI               1065

and so on

Now suppose that in listA you have a new entry for ENGLISH

For this you will calculate in list A the new_ID_Column based on LISTB and will be DEMO-ENG-32, and next you will fill in ListB the value for it equal to  32+1 , so listB will look like

Long desc            doc_type          Current_number_ID

Mathematics           MATH                       521

English                  ENG                        33

Science                         SCI                     1065

Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

bubberz1 on Tue, 07 Aug 2012 13:57:25

thanks again for the help romeo!

So, for listB, and if I'm only using 4 document types, do I only have to have 4 rows to start?

Seems so...just checking...thank you!

romeo donca on Tue, 07 Aug 2012 16:20:28

Yes, right


bubberz1 on Thu, 09 Aug 2012 15:11:01

Hi Romeo,

Now comes the tricky part with the workflow.  I am starting it and not too sure how to go about it.

Wouldn't I need to set a variable to the doc_type in ListA first, so I know when I go to ListB, which one to actually look @ and +1 to the number?  That's a step I have so far...pulling the Doc_Type from ListA actually...which is the main list where you can see history of all the resulting auto-numbers, who assigned to, notes, etc.

For ListB, I'm assuming I'd use the variable set from ListA so I know which doc_type in ListB to look for...because there will always be 4 rows in which of the 4 do I go to.

Once I'm @ the correct row in ListB, I need to +1 to Current_number_ID, hold that in some fashion, and use that for ListA Current_number_ID ...correct?

I am not sure which Action I should take next.

I am now trying a step that looks @ ListB doc_type based the on the variable create in the first step.

Seems a little redundant to create a variable in step1 which grabs ListA doc_type, then create step2 which looks for ListB doc_type based on step1 variable...can't you skip step 1 and do a step with an action of If value equals value?

This seems a little better/leaner approach, but the "Define Workflow Lookup" is a little confusing for this scenario.  It is like I'm in a "Lookup For Number" on the last "Value" box under "Find the List Item".

I'm kinda stuck @ this point!

bubberz1 on Fri, 02 Nov 2012 17:55:06

I have finished the request, and have the steps posted here.  Ran into several "gotchas" that I hope saves others time:

ripollete on Fri, 04 Dec 2015 10:34:46

I followed the steps of SOL WEB SOLUTIONS, and it works with all but a small detail .

When I create the item, I have to be refreshing the page about 5 seconds until the code sets MATH- 0001

Fixed or someone you feel the same ?