Scenario fields are temporary fields with information that are pre-created in the scenario wizard, and are passed to the API-request to the start of the scenario.
Scenario fields are bound to a specific scenario, and the values passed into them are bound to the specific contact with which they are passed. The fields exist and are used from the moment the contact enters the initial “API” block until the contact completes the scenario. When the scenario is completed, the values in the scenario fields are cleared.
Scenario fields are used to store temporary information about a contact that is needed only when the contact goes through a particular scenario. Most often, they are used to store event data (date, time, name, link), information about an event, an order, and any other data that does not need to be stored for a long time (such as the contact's city or date of birth).
To use scenario fields, create them beforehand in the scenario editing window.
Specify the name of the field and its type. Please note that the possibilities of working with this field will depend on the specified type: mathematical and comparison operations are available only for numeric fields, and using the field in the “Pause” block is available only for date and date-time types.
After creating the field, you can pass it with the required value in the /v1/event/start/{scenarioId}/{blockId}/ method (scenarioFields parameter).
You can use scenario fields in blocks:
For example, you can create a chain with reminders about an event by using “Pause before date in scenario field” blocks and sending messages to different channels:
This will be a universal conversation that will send notifications to all the contacts caught in it, regardless of what event they have signed up for and when exactly that event will happen. You can display all the necessary information about the event that is unique for each contact in the messages using the dynamic content methods.
Use of scenario fields is available for Email, WhatsApp and SMS in the message body
You can output the value of the scenario fields in the messages of this scenario using the dynamic content method {{user_guide:scenario:scenario_fields:scenariofield.name}}where Name is the name of the field specified at its creation.
For example, you can pass in the initial API request for fields in the form:
"scenarioFields": { "eventname": "SQL Webinar", "eventurl": "https://events.sql.ru/" }
and output their value in an email message using DC methods in the form:
respectively.
The user will receive a message of the form:
“Hello, you have signed up for the “SQL Webinar” event. The link to the event is: https://events.sql.ru/”