Update variable within a flow does not work

(vonGlick) #1

Hi

I am trying to do a simple thing. I created a test flow where I assign attribute “name” value Marceli. Then I dispaly the name and assign new value to “{{set_an_attribute.attributes__name}}”. And display it again. Value is still Marceli.

Here is a flow if anybody have a hint

https://flowxo.com/share/pr92vxgv

(Daniel Beckett) #2

Hi @vonGlick

In the shared flow you’re setting an attribute called ‘name’

In your send message actions you aren’t actually using the name output from the attribute. At the moment it’s set as:

{{set_an_attribute.attributes__imie}}

This isn’t the name of the attribute where you set the name. Instead it should be either:

{{set_an_attribute.attributes__name}}
{{set_an_attribute_2.attributes__name}}

Based on whether it’s the first or second time you set the name.

Here’s a fixed version of the flow:

Hope that helps. :slight_smile:

(vonGlick) #3

Hi Daniel.

Thanks

Perhaps I am confused but didn’t you set two different variables this way? It made flow bit complex as I need to check two places now.

m.

(Daniel Beckett) #4

It’s all one variable called ‘name’. You’re just pulling through the latest value as it’s updated part way through the flow.

(vonGlick) #5

Can I take latest value without knowing how many times it was updated?

(Daniel Beckett) #6

You can still use {{new_message.attributes__name}} if it’s easier. :slight_smile:

(vonGlick) #7

Thanks for help but it is still so confusing. I made changes to this flow and it seems that {{flowname.attributes_name}} always holds value from previous flow.

https://flowxo.com/share/zqqk7n27

at one point I am displaying in message {{set_an_attribute.attributes__name}} vs {{testflow.attributes__name}} and they have different values.

(Karen Barker) #8

Hi @vonGlick,

Yes you are correct. :slight_smile:

The attribute value held at the trigger will always be the value the attribute was set to when the flow was triggered. This is stored at run time and will not be updated until the flow triggers again.

If you update the attribute during a flow and want to use the new value of the attribute you must use either the value from the Set Attribute action itself or in some circumstances you may need to use the “Get atrribute” action to retrieve the latest value to use.

(vonGlick) #9

Karen, thanks. It helped.