Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I can't think of how this would using out of the box conditions and actions. Here's a quick example:

List A Fields: Created By

List B Fields: User, Number

When I create an item in List A, I'd like the workflow to look at List B. If it finds an item where User = Created By, it calculates Number + 1 and changes the Number field to the result. If it finds no item where User = Created By, it creates one.

share|improve this question
add comment

3 Answers 3

As your logic does not have any human interaction, I would suggest you to attach ItemAdded event and put your logic in ItamAdded event. You would use standard SharePoint APIs to query the ListB and update/create item in list B. Also, Event Receivers are easy to write, deploy and maintain.

If you still prefer to use workflow, you can use following resources:

Update List Item

Create List Item

I am not sure how to check if item in listB exists, which satisfy your criteria. You can always write a Custom Condition and deploy it and use that condition in your Designer Workflow.

share|improve this answer
1  
+1 I reckon it is much more suitable here to use event receivers, than workflows (although it is actually possible). –  Andrey Markeev Jan 11 '12 at 2:25
add comment

This is hard to achieve as SPD cannot check if an item exists. You can only search for an item, but the workflow will break if the item doesn't exist.

There are workarounds but still it's a tricky situation. Here are two I can think of.

If you are using lookup columns, you can check how many items are linked to a given lookup item (in your case it would be either 0 or 1).

Or you can try the following logic:

  1. Create the new item
  2. Search for an item that satisfies your condition
  3. if the search returns the item you created, all is good
  4. if the search returns another item, then delete the new item you just created

Tricky, as I said...

share|improve this answer
add comment
up vote 0 down vote accepted

I ended up doing something a little different than the suggestions but, so far, so good.

List A Fields: Created By

List B Fields: User, Number

Workflow on List A

  • Start: When Item is Created
  • Branch 1
    • Conditions: If List A:Created By equals List B:User (where List B:User equals List A:Created By)
    • Actions: Calculate List B:Points plus 1 (output to Variable:calc), then Update item in List B (where List B:User equals List A:Created By) with Variable:calc
  • Branch 2
    • Actions: Create item in List B (set User to List A:Created By)

This was just an exercise to see if it could be done but the purpose is to see if it's possible to develop some kind of reward/points system for a community site without any add-ons or code. Maybe you could have a discussion board where questions are worth 2 point, responses are worth 3 points, posting a response with a question mark is worth 4 points (because questions in response to questions equals engagement), and posting a document/resource is worth 1 point. Ideally, all these lists could utilize this one basic workflow to track those points and keep a running tally of the most "engaged/active" users.

share|improve this answer
    
Because you are maintaining a list of users (your list B), my suggestion to use lookups (and a reverse lookup field) could apply in your case. –  Christophe Jan 11 '12 at 18:28
    
I'm not sure I follow - both User and Created By are People/Groups fields which don't play nicely with lookup-ing. Are you thinking of some kind of hidden unique key to keep the data clean? –  Cory M Jan 12 '12 at 22:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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