When a contact field is created, the default value is null unless the field is imported with a pre-existing value. To change the value of a recently-created contact field, you can update it using this action or by editing a contact field value via the Contacts tab. 

For example, when a new phone number sends a message to a channel connected to your account, a new contact will be created with a null Name value and null values for every contact field you've added. The new contact will only be identifiable by their phone number until their other field values are updated.

Use the Update the contact action to update the value of an existing contact field for each contact that reaches this node.

Using Variables & Expressions

Contact fields can be updated with a fixed value, expressions, or variables:

@results - the variable assigned to the result of each Split Action node. May also include .value (e.g. @results.[variable_name].value, the value of the incoming message sent by the contact), .category (e.g. @results.[variable_name].category, the category through which the incoming message sent by the contact passed) or .created_on (e.g. @results.[variable_name].created_on, the time at which the incoming message was received from the contact).

@urns- the addresses for the contact (@urns.tel, @urns.facebook, @urns.mailto).

@input - the last message handled by the workflow. (@input.text the text of the last message, @input.channel the channel the last message was handled on, etc.)

@webhook - the parsed JSON payload of the last webhook call.

An expression, e.g. @(now()), @(datetime_add), @(remove_first_word_) and many more*.**

@parent - references variables collected by a parent flow.

@child - references variables collected by a child flow.

Creating a New Contact Field

You can create a new contact field by simply typing the new variable name into the '_Select what to update_' dialogue.



The new field will be referenced by @results.[variable_name].

You can also manually create and edit a custom contact field not included in the default fields following the directions here.

Updating a Contact Field

In the example below, we're updating a custom contact field Due Date that we've created for contacts who have joined our Expecting Mothers group using the @results.due_date variable.



After sending an initial message asking for the due date, we need to collect their response with a Wait for Response action and name the result Due Date:



After creating this Wait for Response, we save the response using the 'Update the Contact' action in a new node.

In the node's '_Select what to update_' dialogue, you can either choose an already created custom contact field or simply type the new field's name create a new field. For this example, we'll create a field called Due Date and it will use the expression @results.due_date, which is the name we gave to the result in the previous 'Wait for Response' node.



That's it! The contact's due date has now been saved to their contact information page.

Once the contact is updated, you can go to your contact's page and see that field:



Incrementing Numeric Values

Contact fields must contain a number in order to be incremented. You can use our expressions language to test a field for a value before incrementing it, e.g:

@(default(fields.age, 0) + 1)
Was this article helpful?
Cancel
Thank you!