• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 810
  • Last Modified:

Custom Unique Number SharePoint Column using SP Designer Workflow

Dear Experts,
I have created a SharePoint Designer workflow that generates custom unique number on "item create". The problem is,
the number does not get generated immediately after the item is created. I have to refresh the page to see the generated ID.
Is there a way to avoid this delay?

Here is the sequence of event for better understanding
1. My List has the following fields: Unique ID, Title,......etc
2. Click on "New" to create a new item, fill out the fields and click OK
3. At this point of time, the Unique ID field is empty (the SPD workflow is in "in progress" state)
4. Refresh the page and you see the generated unique ID field (the SPD workflow status is now "completed")

My concern is to avoid this delay i.e., to get the unique number generated as soon as the item is created.
Is it possible to achieve this using workflows or should I resort to event handlers? If there is a better solution for generating custom Unique Numbers please let me know.

Thank you for reading my post patiently!
0
toramesh
Asked:
toramesh
  • 6
  • 5
1 Solution
 
GreatGermCommented:
You are at the mercy of the workflow gods when it comes to quickness of running.  You can use event handlers, form actions, or use the unique ID that SharePoint automatically assigns.
0
 
torameshAuthor Commented:
Thank you for the ideas. One more question. Wether I take the workflow route or the event handler route, each time the ID is generated a new version is created. Is there a way to avoid or circumvent this issue? Because I don't want the users to restore it to a version before the ID was created. Once again I appreciate your contribution very much.
0
 
GreatGermCommented:
Do they need to be able to see the different versions?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
torameshAuthor Commented:
Well, if they want to roll back to a previous version of that item, they typically naviagte to the version history page for that item and if they do, they get to see a version without the ID and a version with the ID. Since the workflows or event handlers create the ID after the item itlsef is created, it is treated as a new version
0
 
GreatGermCommented:
If they didn't need to be able to roll back to previous versions I would say just remove the view versions permission. Is there a reason you don't want to use the ID generated by SharePoint?
0
 
torameshAuthor Commented:
Workflow fires after a record is created, and if we have version history turned on, version 2.0 is created when the ID is generated. A user could restore version 1.0 and the net effect is that the generated ID number could be deleted.
0
 
GreatGermCommented:
Right, but SharePoint has a unique ID that it assigns to every item on creation.  Go to a view in any list and edit it to show the ID column and you'll see what I mean.
0
 
torameshAuthor Commented:
Yup I know about the ID column, but my requirement is to conatenate ID number with date and generate numbers with 4 digit positions in it. Calculated fields do not work with ID column as the calcuation occurs before the ID is generated for a row. So it would always consider ID as 0. The ID number should also get reset each year. So it looks like custom code to me. And the users do need versioning. That is one of the requirements. Thank you very much for patiently following up with this thread. I am yet to figure out a way to avoid version 2.0 from getting created when ID number is created (both workflow and event handlers create ID numbers by creating another version).
0
 
GreatGermCommented:
The quick way would be to hide your custom ID column in the new item form and use javascript to create your string and assign it to the text box of your custom ID.  That way it's there on the initial version.
0
 
torameshAuthor Commented:
Good suggestion, but how do I access SharePoint's custom list's column using javascript? In other words where do I write this code?
0
 
GreatGermCommented:
You would put the code in the NewItem.aspx page itself. If you don't plan on changing your columns much you can just have it call specifically to that generated ID (you'll have to look at the generated code to see what it is).  If you want to do customization more often I would recommend using jQuery (http://www.jquery.com).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now