1

I have the need to assign a custom unique ID on a Sharepoint List. I have been trying to follow some guides which are getting me close to what I need but not all the way there.

List A Columns - Title, Custom ID

List B Columns - NextNumber (Single line of text)
                 FollowingNumber (Calculated column =NextNumber+1)
                 NextUniqueId (Calculated Column ="PAY-&TEXT(FollowingNumber,"000')

So when I add an item to List B (number 2 for example) the FollowingNumber column increments by 1 and the NextUniqueID will return PAY-003. All good so far.

I would like to add an item in List A and have the Custom ID field be populated with data from the NextUniqueID column in List B. So this would require a new list item added to List B, incremented by 1 in the NextNumber column, and then the Custom ID in List A getting the data from the NextUniqueID column in List B.

I have set a Workflow on List A, but can't get it working properly, both incrementing the NextNumber List and then assigning the data back to List A.

0

I am not 100% sure why you need to do this in two lists as it would be easier to achieve in one unless you need the second list for a lookup column for other reasons.

For your question I suggest removing any calculated columns and using workflows. I have used the following setup.

  • List A has two columns, "Title" & "Custom ID"
  • List B has two columns, "Next Number" & "Unique ID"

See image of both lists enter image description here

The workflow is separated into three stages for ease of reading but can be done as one stage:

enter image description here

Workflow Stages

  1. Create Item ID: Create an item in List B with the "Create List Item" action.

Set the "Text Number (*)" field value to "Variable: ItemID" and click ok.

  1. Update List B Unique ID: Update item in ListB with "update item in this list" action.

Select "ListB" from the List drop down menu.

You will need to firstly add the field value for "Next Number" to "Variable: ItemID" and "Unique ID" to "PAY-000[Variable: ItemID]".

Then you will need to find the list item. To do this select the field "ID" from the drop down Field at the bottom of the window. Then select the value of "Variable ItemID". You will need to swap the data source from Current Item to "Workflow Variables and Parameters" then select the variable.

  1. Update List A Custom ID: Use the action "Set Field in Current Item" and choose the "Custom ID" field and for the value click on the function icon "Fx". Change the data source to "List B".

Select "Unique ID" from "Field From Source"

In the find the list item section select the field of "ID" and the value of "Variable ItemID"

Publish your workflow (remember to set the workflow settings to start on creation unless you want to do it manually).

The workflow should now create the unique ID in the new list and then bring that unique ID into the Custom ID field.

If the number needs to be increased by 1 I can edit this post to add the calculation. Also prefixing "000" in your unique number will require you to add more actions in your workflow e.g. If ID < 10 prefix "000" if ID < 100 prefix "00".

| improve this answer | |

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.