Buni.aiDocs
USSDChatbotVoice (IVR)Automation

Set Fields

Sets or transforms state variables by assigning a value or expression to each named field, so later nodes can read them.

Set Fields writes values into flow state. Each row names a field and gives it a value: a fixed value, a reference to another variable, or an expression. Later nodes read the result as {{state.fieldName}}.

When to use it

  • Give a variable a starting value, such as attempts = 0.
  • Copy or rename a value: save {{input.phone}} as customerPhone.
  • Build a string from other variables: Order {{state.orderId}} for {{state.name}}.
  • For anything that needs real logic (loops, date maths, parsing), use a Function node.
  • For date arithmetic, use Date & Time.
Set Fields panel with three field rows: customerName, orderTotal and greeting

Settings

Prop

Type

How the value is read

The same field behaves slightly differently on each runtime. Write values in the form the table marks as supported for your project type.

Value you typeUSSDChatbotAutomationVoice
A variable template, {{state.firstName}}YesYesNo, use state.firstNameYes
Text with templates, Hi {{state.firstName}}YesYesNo, use a ${…} templateYes
A bare reference, state.firstNameYesYesYesNo
An expression, state.count + 1No, kept as textYesYesNo
Plain text, WelcomeYesYesQuote it: 'Welcome'Yes
A number, 42, or true / falseStored as a number or booleanSameSameStored as text

Numbers with a leading zero, such as 0712345678, are kept as text on USSD and chatbot projects, so phone numbers and PINs are not changed.

Automation projects evaluate every value as JavaScript

In an automation, the value is run as a JavaScript expression. Plain text must be in quotes ('Welcome'), and {{state.x}} templates are not resolved: write state.x, or a template such as ${state.x} for text with variables in it. An expression that fails leaves the field undefined. A dotted field name is stored as one flat key (state["customer.firstName"]), so avoid dots there.

Outputs

One output. The fields are written to state before the flow continues; the next node receives the same input Set Fields did.

Example

After an API node saves a customer record as customer, a Set Fields node on a chatbot project prepares values for the next few nodes:

Field nameExpression or value
customerName{{state.customer.name}}
greetingHello {{state.customer.name}}, welcome back
attempts0

A Reply node can then send {{state.greeting}}.

Tips and limits

  • On USSD and chatbot projects, a field name that cannot be used (a space, a leading digit, __proto__) stops the project from publishing, with an error that names the node. Automation projects silently drop the characters that are not allowed instead.
  • A row with an empty field name is ignored. On USSD and chatbot projects a Set Fields node with no named fields at all fails the publish.
  • Picking a secret inserts ${CREDENTIALS.NAME}. It resolves at run time; do not write secrets into fields that are later shown to users.
  • To compute a value on USSD, use a Function node: USSD resolves references but does not evaluate expressions.
Last reviewed 24 September 2026

On this page