Custom Field and User Input Setup in Flow

Printing Custom Field in Message Block

If you have set a custom field to users and wish to display its value in a message, you can input {{customFields.fieldvalue}} to the Message Block. If the custom field that you want to display is "membership", where the value is "diamond", then you can input {{customFields.membership}}. When the user triggers this flow, he will see the value "diamond" in the message.

print custom field value of the contact with {{customFields.fieldvalue}}

This example shows a message with clickable options that set custom field and print out the custom field value.

This is the actual result upon clicking the option "Moisturizers" from the above flow.

Printing User Input Variable in Message Block

If you have set a user input block, you should have already set the variable that stores the user input. When the variable is stored with value, you may call the variable in a Message Block with curly brackets, such as {{age}}. Putting a variable in a message block can make your conversations more dynamic.

print user input variable value of the contact with {{userinputvariable}}

This example is a user input block with condition funnel that determines whether the age is over 18. If below 18, the message will print the actual age and explain that the business can't proceed.
This is the actual result upon replying "17", a digit below 18, which returns the result from the above flow.

Storing User Input Variable into Custom Field Block

For more sophisticated scenarios, you may wish to collect user input value while storing the value into a custom field. What you need to do is to create a custom field block right after the user input block. Then, you need to put the variable into the field value. For example, if you name the user input variable as "age", you should put {{age}} into the field value.

This example is a user input block with custom field that stores the user input variable.
This is the actual result upon replying "16", a digit below 18, which returns the result from the above flow.

The above example is a complicated version of the previous flow. The difference is an additional Set Custom Field Block inserted in between User Input and Condition Funnel Block. The user input variable is stored in the field value of the field "age". And the final message block is also adjusted to be {{customFields.age}}.

The message displayed is all the same as the previous flow, but the user input variable is stored into custom field, so that you can keep the value for other purposes, such as keeping conversation history, filtering contact according to custom field result, exporting contact with custom fields etc.

Since the user input variable {{age}} is stored into the custom field called "age". Therefore, no matter you try to print the user input {{age}} or the custom field {{customFields.age}}, you can still get the expected result.

Last updated