Well it's related. I set up two news lists on our live environment as proof of concept in case it was a problem with our dev site. I'm getting a different result, but still not the right one.
How is your query structured? Typically, a query returns items in a collection variable, which could potentially explain some of the strangeness you're seeing. If you log "Inven_Number" and check the value, you might be able to troubleshoot from there. This will all depend on what are you querying InventoryListOne for (how your query is structured).
On this the variable is set up as a number and on my previous question it's set up as string, so could that be it. Should I set the variable up as Collection Variable?
In your query action, when you pick the variable, if there isn't one already created, you should have the option to create a new one. If you do it that way, it default picks the variable type that is most useful/common/relevant. If you do that, what type of variable does it try to create? A collection variable?
It was initially set to text, so I changed it to number, with default set at 0 but it's still not updating.the default of the column it's updating is also set at 0.
On Configure Action I've got Where set to DeviceID, Equals set to Value and 0 Field set to DeviceID Equals Workflow Data and the variable id_number. I'm going to try setting up the variable to be a collection and see if that makes a difference
I set up a Collection Variable but by the time I get to the Update item or the Set Field Value the drop down is not giving me that variable? Also would I be right in thinking if you disable an action that the Workflow wont run through it. The best I'm getting back is still "1".
Correct, if you disable the action the Workflow should not execute it, it should just skip over it.
So, these are two separate lists. List A and List B. List A has column X and List B has column Y. You want to copy the contents of List A column X to List B column Y, right? How do you pick the item in List A? As in, what criteria does it need to fit to be sure it's the item you want? For List B, same question?
Here's an example to see if I can illuminate this a bit more:
I have List A of Devices with column X which holds the device name (laptop, mobile phone, etc). List A also has Column W, which holds an "ID" for that device type (1, 2, 3). These IDs are unique to each device name. List B is inventory of what users have what devices and I want to get the ID from List A to put with the device. So I have this:
List A:
Device Name | ID |
---|
Laptop | 1 |
Mobile Phone | 2 |
Mouse | 3 |
List B:
User | Device | ID |
---|
Janet | Laptop | |
Frank | Mouse | |
Lynn | Mobile Phone | |
Phil | Mouse | |
I want the workflow to put the ID that correlates to each device name into List B. Here's how I do that on a workflow that runs on List B on item creation:
Field: The field of the current item in List B (the one the workflow is running on ) that I want to update. I want to update the ID column
Value: Ok, here's where I lookup to the other list to see what ID I want. So the source is List A, because that's where the info I want lives. The field I want to copy out of is ID. Now, how does it know which item ID I want? Well, I want the one that matches the device name I'm using. So, I say where "Device Name" equals the Device Name of my current Item.
After I run the workflow, I should end up with this:
List B:
User | Device | ID |
---|
Janet | Laptop | 1 |
Frank | Mouse | 3 |
Lynn | Mobile Phone | 2 |
Phil | Mouse | 3 |
Does this make any sense? You may not need a query list action at all.
That does have a logic. I'll set out what I'm trying to do. The Workflow fits in with a HTML and JavaScript file where the ID number helps create a URL. So...
Here's my first list: Devices:
The number in the ID Column is an automatically generated number.
Here's my second list Knownissues:
The DeviceID column is the one I want to update with the Workflow. Currently it's a Number column with the default value at 0.
Here's my Workflow. I swap between the Set field value and Update item action to try and get the DeviceID column to update:
I've set the Query List to look at the Devices list. I've selected the ID column and stored it in a number variable called id_number:
I've then set the Update Item to update Known Issues where DeviceID value is 0. I've selected the DeviceID and Equals to bring back the id_number variable. The Workflow settings are set to run automatically but when I add an item to the KnownIssues list the number in DeviceID doesn't update when the Workflow completes. I can't see where I'm going wrong?
Darren, can you try implementing what I've outlined above? Make it a list workflow on your KnownIssues List and set it to run on item creation
Hi Courtney. The Workflow is already on the Knownissues list and on the Workflow Settings I've set it to Start when items are created. I've got the Actions set as pictured above. When I configure the 'Set field value' I don't get the screen in your post. Do I need a different Action?
Hmm, your set field action doesn't look like mine? Must be a 365/2013 difference Were you ever able to get your variable to log to the workflow history to see what kind of value you're getting there? After your query?
No, nothing came out of the log. I've popped it in again, and the result is below. Along with what my Set field value looks like:
Where you have "Workflow Data," do you have another option like "Lookup" or "List Lookup"?
Ah yes! I've got this! What should I set the When field to?
It should be when "Title" equals "Device" like so:
What you're saying here is pick the item in the Devices list where the Title of the item in that list (Devices) equals the Device field of the item you're running it on in "Known Issues."
I had high hopes for this, but it's still not returning the result unless I've set it up wrong?
Change your "Field," the bottom-most dropdown to "Device" like I showed on the screenshot and I think we'll be golden
BOOM! That worked when I changed 'When' to ID thank you so much @courtneyvargo couldn't have done it without you!
Awesome! Can you mark an answer as correct so others can benefit too?