Chat script actions — saving answers to records
A chat script that only asks questions leaves the answers buried in the message feed. Chat Script Step Actions close the loop: when the customer answers a step, the action writes that answer into a field on the Salesforce record the conversation is filed against — a rating into Rating__c, a budget into Budget__c, a yes/no into a picklist. This article shows how to add actions and what happens when one fails. These examples require a field compatible with the textual response, or tested conversion automation; verify that the parent message’s Record Id belongs to the script’s Applicable Object.
- Your script template and its steps should exist — see Chat script steps.
- Know the API name of each target field (Setup → Object Manager → (the script's Applicable Object) → Fields & Relationships).
- Remember the fields live on the script's Applicable Object — that's the record the answer is written to.
Which record gets written?
The action uses the Record Id from the parent message, exposed on the step, together with the script’s Applicable Object. For a direct Contact script this is the Contact. A related-record configuration can instead put Contact in Record Id and Opportunity in Parent Record Id; do not assume the action automatically chooses the context page or parent. Verify that the target Id belongs to the Applicable Object.
Step 1 — Add an action to a step
- Open the step (on the script template), find the Chat Script Step Actions related list, and click New.
- Fill in the fields:
| Field | Required | What to enter |
|---|---|---|
| Action Name | Yes | e.g. Save rating. |
| Chat Script Step | Pre-filled | The parent step whose answer this action saves. |
| Type | Yes | Choose Field Update — the only action type. (It is not pre-selected; you must pick it.) |
| Field API Name | Yes for Field Update | The API name of the field to update on the Applicable Object record — e.g. Viewing_Rating__c. Leaving it blank fails the save with: Field API Name must be provided for Field Update script actions. |
| Description | No | Notes for your team. |
Leave the system-managed fields alone: Is Completed and Error Message report action processing. Check the target field too: completion alone does not prove that a nonblank answer was written.
- Click Save.
Expected result: the action saves under the step. Like steps, actions are cloned onto every running conversation started from the template.
FirstName) that the customer's reply is written into.What exactly gets written
The step's Response value — the customer's reply text, exactly as recorded:
- A typed reply writes the typed text.
- A reply to a WhatsApp interactive button/list step writes the tapped option's id (its developer value), not its on-screen label. Design your button/row ids as the values you want stored (
5,yes,reschedule), and the stored data stays clean. - The handler assigns the response as a String. Use a compatible text field for free text. Even an interactive option whose id contains only digits does not guarantee conversion to a numeric, date or checkbox field. Use tested conversion automation when another datatype is required.
An eligible response processed during the active session schedules the actions in the background. An expired response does not start that workflow, but actions already scheduled can execute later. See Chat script sessions.
When an action fails
A field update can fail — wrong API name, a value the field won't accept, a validation rule on the target record. When it does:
- The failure is captured on the action record of the running conversation: its Error Message field holds the technical reason and Is Completed stays unticked.
- An action failure does not necessarily stop the conversation. Next-step creation and background actions are separate. A caught field-update error can leave the next step running, provided its own send and processing succeed. Check script-level errors separately.
- Nothing is sent to the customer about the failure.
This is different from a deeper automation failure (the advance process itself erroring): that is recorded in the running conversation's own Error Message field, and a conversation with a script-level error halts — further replies are recorded as ordinary messages, but no more steps are sent. If a conversation stopped dead, check the running script record's Error Message first, then its actions'.
Worked example
Feedback survey on Contact, step 01 - Ask rating (an interactive button template with ids 1–5), action Save rating with Field API Name Viewing_Rating__c:
- Customer taps the button labelled "Excellent (5)" — its id is
5. - The step's Response records
5, and the next step's question goes out. - For this example, use a field that accepts the textual value
5. If the write to Viewing_Rating__c succeeds, the action marks Is Completed. Check the target field too; the completion flag alone is not proof that a nonblank value was written.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Field API Name must be provided for Field Update script actions. | Type is Field Update but the field name is blank | Enter the target field's API name |
| Action's Error Message filled, Is Completed unticked | Bad API name, incompatible value, or a validation rule on the record rejected the write | Fix the field name/type, or relax the record's validation for this path; the customer's answer is still safe in the step's Response |
| Answers recorded but no action ever runs | The session expired before the reply, or the template's session length is blank | See Chat script sessions |
| Conversation halted entirely, script's Error Message filled | An automation fault on the conversation | Read the error text on the running script record; fix the cause; start a fresh script run for the customer |
FAQ
Yes — add several Field Update actions to the same step to write the same answer into more than one field.
Not through a separate record selector. The action uses the parent message’s Record Id with the script’s Applicable Object; verify that they match, especially with related-record configurations. To propagate a successfully written value elsewhere, use your own Salesforce automation.
No — Field Update is the only type in the current version.
On the running conversation's copies: the action's Error Message for field-update failures, the script's Error Message for conversation-level faults. Administrators can also monitor Connect Logs.
Where to go next
- Chat script sessions — the timer that decides whether actions run at all.
- Running a chat script — start the script and watch the fields fill in.