last day (15 days later) » 

10:27 PM
1
A: Update List Item when value is changed

Aron FosterYou 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'...

 
BGM
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.
 
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.
 
BGM
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.
 
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.
 
BGM
Aron, I understand about storing a value in the column. The StockID is a multi-select - it's an array.
 
10:27 PM
Can't you make SupplyIDArchive the same type?
 
BGM
You mean to make it a filtered lookup, too?
 
Yeah, I think that would work. My instance of SharePoint is broken right now or I'd verify. You could also try making it a string and assigning it the value of your StockId via workflow; the way SharePoint stores multiple selections and lookups is pretty straightforward, and you might be able to massage the string to get the IDs and unmark the sold items.
 
BGM
Uh, problem; you can't set a default on a filtered lookup. So if nothing is chosen in the first filter, it gives an error. I'll play with this idea, however.
Also, if I have more than one Supply Item selected, having a single value in SupplyArchiveID won't work. Multiple values means the workflow would have to check each item in the ArchiveID to see if it exists in the StockID.
 
How were you doing the update to the Supply list when multiple items were selected for it to "work like a charm"? Note that "multiple items selected" just means that there are multiple semicolon-delimited numbers as the value of the lookup column. Make a string variable in your workflow, set it equal to your lookup column, and log the string value to see how it works.
 
BGM
@aron-foster the only time it worked was when I set it to detect whether the StockID was empty. If it was empty it would update the record.
I actually tried using string variables, too.
I am thinking that contains tries to see if the entire field is contained in the other string.
I've captured StockID into a string variable and then said, If SupplyArchiveID contains StockIDvariable.. and If SupplyArchiveID does not contain StockIDvariable...
I understand the string value is concatenated with # and ; symbols. But there is no option in the workflow to loop through it.
Maybe I have to regex it.
 
BGM
10:51 PM
Agh! Regexing it would only get me a single value.
 

last day (15 days later) »