Table of Contents

Set a Field block

Hajar Updated by Hajar

Prefer watching than reading? No problem, we've got you covered πŸ‘‡

for Landbot (Web)

Note: This Block is only available on Premium accounts.
Variable is now called Field

Set a Field is a powerful block that allows you to create, establish a format, and set a value to a Field. And now you can also use it to unset a Field's value!

To create the block just drag and drop the green dot and select "Set a Field":

If you are unfamiliar with the concept of a Field, please refer to this article.

You can think of a field as a box, that you can name and where you can store "things". In this case, "things" are values (numbers, texts, dates, etc...).

Block anatomy & set up

Set mode

Create or select a field to modify:

You can select a Field that already exists or create a new one, just type the name (no spaces are allowed), select the format, and click on "create".

Select the format:

Here you need to specify the type of format the Field will store:

You have four options:

  1. String (text)
  2. Number (float)
  3. Date (YYYY/MM/DD format)
  4. Array (a group of elements of the same type)
Boolean: It is not possible to create or save Field in this type of format, because this is a system Fields that is used only in the Conditions block to check if the agents are online.

"Type the value" section:

In this case, as the label says, you can type the value you want to give to the Field. It is also possible that instead of typing down such value, making it depends on other Field values.

Perform a (mathematical) calculation

Number and Dates can be used to make calculations for the Field.

For numbers, the available operations are:

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)
  • Modulus "remainder" (%)

For dates, the available operations are:

  • Addition (+)
  • Subtraction (-)

Using date operations, based on a field that is a date (with Landbot format) you can sum or subtract days or months, or years to that specific date:

Finally, once the block is set, you have two possible outputs: Success or Failed.

Field names have a 100 characters limit. If surpassed, field might have issues being displayed in the bot.

Unset mode

Now it's possible to leave a field's value empty by switching to Unset modeπŸ“­

Unset a field means to assign an empty value to an existing field, when the flow goes through this block.

Unset a file field: When unsetting a field storing a url to a file (those created in file blocks) will not be accessible; the url will show is broken.
Note: It will not delete the field itself, only leave its value empty.
Unset multiple field's values:

You can add multiple field to unset their values at the same time by clicking on Add button:

It's possible to unset any custom field, however, you cannot unset:

- System fields (Last seen, Created, Time references, URL, Country, Browser, Device, OS)
- Lead data (Name, Phone, Email, Company, ID)

For more information about Landbot System fields, please check here.

Why is there a "failed" option for a set field block?

If everything is correct, we will continue the flow with the Success (green output).

However, if the user had used the wrong input or format and we are using the "Perform a calculation?" feature, it will generate an error, and the flow will continue through the Failed output. It is a good practice to use it, to avoid the bot from crashing.

Block user examples

Below three short example of how the Set a field block works:

EXAMPLE 1 - Concatenate fields: In case we would like to store in a field (@userinfo) many inputs from the user (@name, @email, and @phone), to do so, we need to write the field in a different way, here is how:

EXAMPLE 2 - Build URL with fields: Maybe you need to build a URL , where the customer will be redirected, with values from the inputs, here is how:

Warning: the URL must be an HTTPS://Β otherwise you will get an error that will not allow you to save changes.

EXAMPLE 3 - Update fields value with a new value: We can add values to the same field, progressively one question at a time. Here is how it would work:

Set field block Troubleshooting & Faqs

Can I do calculations between two dates?

Currently is not possible to do calculations between two dates with Set a field block.

How can I Set a field with the Date format?

In the Set a field block, the format for a Date field should be YYYY-MM-DD

Keep in mind that in Landbot, the date is saved in the format of YYYY-MM-DD, with the dash or hyphen (-), and won't be accepted if the date is added with a slash (/)

For WhatsApp

This block behaves exactly the same way as in the landbot (web) version.

For Facebook Messenger

This block behaves exactly the same way as in the landbot (web) version.

How did we do?

Landbot System Variables

Any of the above Output

Contact