Solved

Set Field Value returning '1' instead of actual value


Badge +10

I've got two lists:

 

InventoryListOne and InventoryListTwo. In list One I have a column called Id Test with numbers in them, I've created 4 items, so the ID Test numbers run from 1 - 4. In list Two  there's a column called DeviceId. On list Two I've created a Worklow and have a Query List item where I query List One and the ID Test column and save it to a variable called Inven_Number. Next I have a Set field value which is set to DeviceID, Equals Workflow Data and then Inven_Number but when I run the Workflow it just updates the DeviceID column to '1' regardless of what the number in ID Test is in list One? What am I doing wrong?

icon

Best answer by darrenfloyd666 26 June 2017, 17:17

View original

21 replies

Userlevel 5
Badge +13

Darren, is this the same question you've asked here:

Updating a Field uisng Update item or Set Value Action 

 

Badge +10

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. 

Userlevel 5
Badge +13

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).

Badge +10

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?

Userlevel 5
Badge +13

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?

Badge +10

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

Badge +10

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".

Userlevel 5
Badge +13

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 NameID
Laptop1
Mobile Phone2
Mouse3

List B:

UserDeviceID
JanetLaptop
FrankMouse
LynnMobile Phone
PhilMouse

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:

UserDeviceID
JanetLaptop1
FrankMouse3
LynnMobile Phone2
PhilMouse3

Does this make any sense? You may not need a query list action at all.

Badge +10

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:

Device List

The number in the ID Column is an automatically generated number.

Here's my second list Knownissues:

Knonissues list

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:

Workflow

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:

Query List

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?

Userlevel 5
Badge +13

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

Badge +10

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?

Userlevel 5
Badge +13

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?

Badge +10

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:

Userlevel 5
Badge +13

Where you have "Workflow Data," do you have another option like "Lookup" or "List Lookup"? 

Badge +10

Ah yes! I've got this! What should I set the When field to?


Userlevel 5
Badge +13

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."

Badge +10

I had high hopes for this, but it's still not returning the result unless I've set it up wrong?

Userlevel 5
Badge +13

Change your "Field," the bottom-most dropdown to "Device" like I showed on the screenshot and I think we'll be golden

Badge +10

BOOM! That worked when I changed 'When' to ID thank you so much @courtneyvargo couldn't have done it without you!

Userlevel 5
Badge +13

Awesome! Can you mark an answer as correct so others can benefit too?

Badge +10

Done and done!

Reply