We use two lists to keep track of some computers we refurbish. There is one list for Supply and one for Sales.

In the Sales list there is a filtered lookup field that allows you to choose from items (choose by the list item ID) in the Supply list whose "Sold" field is not set to Yes.

So, since the user has added an item from the Supply, I have created a workflow to mark Supply's "Sold" field to true.

This works like a charm.

My problem is this - what if a user decides he chose the wrong Supply item and removes the old value and adds a new one? Or what if he removes the value? That means I need to have the workflow mark the deleted/changed item as unsold in the Supply list.

To complicate matters, the selector in Sales allows for multiple selections of the Supply IDs. This is because one sale might involve more than one item, so the user selects all the available items he needs.


A bit of info:

Premise: In Sales, there is a multi-select lookup that allows the user to choose from items in Supply (selecting by the list ID field) if the item's "Sold" field is not marked to "yes". The user can only choose from a list of items that are not sold, so there is no risk of entering an already-sold item.

Goal: When a user uses the Sales list to select unsold items from Supply, Sharepoint should go and mark the Supply item as sold.

Problem: If a user changes the Supply ID in Sales, this needs to be reflected in Supply. In other words, if the item is removed from the Sales list, it needs to get "unsold" in Supply. And since the user can choose more than one item, this needs to happen for each item in the sale.

So, here is a list of what I think needs to be accomplished somehow:

  1. Before a user adds/changes the StockIDs in the Sales list, fetch the current value into a variable called "SupplyArchiveID"
  2. The user makes their edits normally, and selects Supply items
  3. Sharepoint checks to see if the before and after states are different.
  4. Sharepoint marks both the current items sold.
  5. Sharepoint marks as unsold any items that exist in the originalStockID but don't exist in the updated list.

Now, how can I accomodate that in the workflow?

  • I can fetch the old values into a field in the list whenever an edit is made. Now, when the user saves the list item, I have both the new value and the old value.
  • How do I compare the two arrays?

I've tried this:

  1. First I created a column called SupplyArchiveID to be used by the workflow.
  2. If there is an item in SupplyArchiveID that is in StockID, then in the Supply List, mark the item a sold.
  3. If there is an item in SupplyArchiveID that is NOT in StockID, then in Supply List, mark the item as unsold.
  4. Finally, equalize the two values (StockID and SupplyArchiveID) for when we restart the process.

enter image description here

But this doesn't work right. I am not sure that contains is checking against every value. I am thinking it doesn't work this way.

2 Answers 2


You could add another column to the Sales list. Call it SupplyIDArchive. Make it a number, default 0, and use custom InfoPath forms (or whatever method you prefer) to prevent users from changing it directly. When a user makes a change to the lookup field, check if SupplyIDArchive is 0. If it isn't, change the item in the Supply list with corresponding ID to "Unsold". Then (regardless of if it was 0) update it to equal the selected Supply lookup.

This potentially introduces another error: if the user selects an item that's already been sold. You could prevent this by filtering the dropdown/lookup to only show unsold items or by adding another column and then logic in the workflow to count how many times an item has been marked sold.

  • Thanks for answering, Aron. Actually, Supply is filtered to show only items whose "sold" field is false, so the user is not able to select an item that is already sold. That's why in Sales I need the workflow to mark it for me so that it gets removed from the selection list.
    – bgmCoder
    Commented Jan 29, 2015 at 23:13
  • Well, then the above solution should work for you. Let me know if/how it doesn't and I'd be happy to troubleshoot with you. Commented Jan 29, 2015 at 23:15
  • In your scenario, that means that if the workflow has to store a SupplyIDArchive that it has to be cleared at the end of the workflow if the item is marked unsold. Also, I forgot to mention that the Sales list has for the StockID, multi-select because you can sell more than one item in a ticket.
    – bgmCoder
    Commented Jan 29, 2015 at 23:16
  • I'm having trouble understanding you. Don't store it in the workflow; store it in the actual Sales list as a column. If the SupplyIDArchive column doesn't match the StockId column, you know what it was changed from and what it was changed to, and can use that information to fix your Supply list. Commented Jan 29, 2015 at 23:20
  • Aron, I understand about storing a value in the column. The StockID is a multi-select - it's an array.
    – bgmCoder
    Commented Jan 29, 2015 at 23:33

Out of the Box, Sharepoint Workflows will not operate on entries in the multi-select lookup values - there are not functions within Sharepoint Designer to operate individual values within the concatenated string.

To do that you have to use a Visual Studio Solution. Here is a method for fetching the values within VS.

And I'm not the only one to have this problem.

If I get a more complete solution I'll post it.

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.