How to use attributes

(Kevin Robinson) #1

Hey,

I’m really struggling with this. My logic and the documentation I’ve read suggests this should work - but it doesn’t.

I ask a user for their name, then set it as an attribute. The logs show the following:

Attributes
{
  "name": "Kevin"
}

The next action is a question. The question text is set as:

Are you currently aclient, {{catchall.attributes__name}}?

However, it outputs as:

Are you currently a client, ?

What am I doing wrong here? As far as I can see I’m setting the attribute correctly, it is saving correctly, but I can’t use it.

(Karen Barker) #2

Hi @Kevin_Robinson,

Once the Trigger has run, the values stored as it’s output will not be updated. Therefore if you have only set the attribute during the flow it will be blank (or an old value) on the trigger. When you set an attribute in a flow you’ll need to use {{{{set_an_attribute.attributes__name}} instead. :slight_smile:

1 Like
(Kevin Robinson) #3

I’m not sure I understand that - could you clarify please?

At what point is the attribute saved to attributes?

And how do I access attributes during my flow?

Your solution doesn’t work for me, I don’t think. Or perhaps I misunderstood.

I want to write an attribute from several different places. E.g.

If [user first name] exists - set attribute [name] to [user first name]

And also

If [user first name] doesn't exist - ask for name and use that answer to set attribute [name]

This would require two different ‘set attribute’ actions which could both write to the same ‘attribute’.

Is there no way of accessing this simple global attribute within a flow?

(Karen Barker) #4

Hi Kevin,

Ah…If you need to set it from various different situations but use the result of either set attribute in the message then you will need to add a “Get Attribute” action into your flow just before sending then message. In the message you can then use {{get_an_attribute.value}} to provide the current attribute value. :thumbsup:

(Kevin Robinson) #5

Super, that makes sense. I’ll go in and have a go - thanks :slight_smile:

(Kevin Robinson) #6

:raised_hands: :raised_hands: :raised_hands: :raised_hands:

1 Like
(Andrew Catchpole) #7

@Kevin_Robinson Attributes had me struggling for a while. Once explained a few months ago it is now much easier to implement. Good luck with your flows.

#8

Hello Karen,

I have been able to save attributes on an application/registration flow but i want to retrieve them mid-flow so as to stop the flow if the user is already registered. How can i retrieve them best?

(Karen Barker) #9

Hi @Omoshx78,

If you’ve only set the attribute once in the flow then you’ll be able to use the output of the SetAttribute action to retrieve the attribute value. If on the other hand the attribute could have been set in multiple locations in the flow it’s possibly safer to use the Get Attribute action and then use the value returned as the output to this action. :thumbsup:

#10

ok in my flow design, i set the attributes at the end of all flows and i can see from the logs they are all set. problem is how to retrieve the same at some point in the flow to remember a user and stop them from continuing with the application unless they are editing some details.

(Karen Barker) #11

Hi @Omoshx78,

There are 3 ways of getting the value of an attribute

  1. From the Flow Trigger output - You’ll be able to use this is the value has been set prior to the flow being triggered
  2. From the Set Attribute action - Use this if you’ve only set the attribute once in the flow and then want to use the attribute later in the same flow
  3. Using the Get Attribute action - Use this if you’ve set the attribute in multiple locations in the flow and want to use the latest value set in the same flow.

If you’re only setting the attributes at the end of a flow then is it the next time the flow is triggered that you want the value? If so then you’ll be fine using the 1st method above, so just use {{triggerName.attributes__attributeName}}.