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 action.
Using Variables & Expressions
Contact fields can be updated with a fixed value, expressions, or variables:
- @flow - the variable assigned to the result of each RuleSet. May also include .text (e.g. @flow.response_1.text, the full text of the incoming message sent by the contact), .category (e.g. @flow.response_1.category, the category through which the incoming message sent by the contact passed) or .time (e.g. @flow.response_1.time, the time at which the incoming message was received from the contact).
- @date - used to call date values (@date.now, @date.yesterday, @date.today, @date.tomorrow)
- @channel - the channel that handled the incoming message (@channel.name, @channel.tel, @channel.tel_e164).
- @step - the contact who sent the last message handled by the workflow. In most cases, this is also the active email@example.com
- @extra - references variables pulled from an external application via a WebHook.
- An expression, e.g. @(HOUR(NOW())).
- @parent - references variables collected by a parent flow.
@child - references variables collected by a child flow.
Creating a New Contact Field
Learn how to create a custom contact field not included in the default fields here.
Updating an Existing Contact Field
In the example below, we're updating a custom contact field 'Join Date' that we've created for contacts who have joined our Expecting Mothers group using the @contact.join_date value.
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:
@(IF(contact.<field> <> "", contact.<field>, 0) +1)