2

I am trying to create a functionality for a list where all entries get a custom ID. The IDs are going to have the following formats

List1
Year-1
Year-2
Year-n

List2
Year-1.1
Year-1.2
Year-1.n
Year-n.n

Now I have looked up a bit and the solution for custom auto incremental fields appears to be the following:

  • Create a new list with a CounterName, a LastNumber and a NextNumber
  • On your CustomList create a Workflow which retrieves the NextNumber
  • Then increment the LastNumber on your CounterList (NextNumber is a calc. field)

Well so far so good, this works if i have set counter names. The problem is: Years on List1 and the "Name" on List2 are pretty variable. And every variable needs a new Counter like "Counter2012", "Counter2013", "Counter2014" and "Counter2012-1", "Coutner2012-2", etc...

Now with SharePoint Designer, to my understanding, there appears to be no way to check if a List contains an item with a given value.

Now up for my questions:

  1. Is my above assumption correct, is there really no way to check if a listitem with a specific value exists?
  2. Right now I'm trying the SPD-way, is there possibly a VS-way to achieve my goal?

Summing it all up, I basically want a workflow to do this:

Check if List "Counters" has an Item with "CounterName" == "BLA-%YEAR%"
  No: Create Item with "CounterName" = "BLA-%YEAR%"
  Yes: Simply continue

Next Workflow steps are not specific to this question and work fine.. ;)

This is the source where I got my initial idea from: http://splittingshares.wordpress.com/2008/04/11/auto-increment-a-number-in-a-new-list-item/

1 Answer 1

1

OTB conditions are documented here http://office.microsoft.com/en-us/sharepoint-designer-help/workflow-conditions-in-sharepoint-designer-2010-a-quick-reference-guide-HA010376962.aspx and I don't see the condition you are looking for.

But you can always write Custom workflow condition And make it available in sharepoint designer for your workflow.

Since your workflow is just assigning a unique id to a field and no human interaction is needed, I would look for achieving the same using ItemAdded/ItemUpdating event receivers for the list

1
  • OK, thanks for confirming what i found out. Guess this boils down to write my own condition then, gotta look into that. Will update my answer as soon as I've got it working ;)
    – Sam
    Commented Jan 18, 2012 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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