Prepare the Assets for a Voice-Enabled Scheduling Agent in the Legacy Agentforce Builder
Create a flow, an agent action, and a subagent for your voice-enabled scheduling agent.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions with Field Service and Foundations, or Einstein 1 Field Service Edition or Agentforce 1 Field Service Edition. |
Create the Flow
Create a flow that identifies the caller automatically by their phone number instead of asking them to provide an email or username.
Create an Autolaunched Flow that performs the following:
- Identifies a caller according to their phone number
- Finds their contact record
- Generates a 6-digit verification code
- Sends the code to the contact’s email address
- Returns the verification code that the caller gives
Variables
| API Name | Details |
|---|---|
| authenticationKey | Data Type: Text Available for output |
| customerEmail | Data Type: Text Available for output |
| customerId | Data Type: Text Available for output |
| customerIdType | Data Type: Text Available for output |
| incomingPhoneNumber | Data Type: Text Available for input |
| verificationCode | Data Type: Text Available for output |
| verificationMessage | Data Type: Text Available for output |
Constants
| API Name | Details |
|---|---|
| codeNotSentMessage | Data Type: Text Value: I’m having trouble sending you a verification code. Please call our contact center directly. Have a nice day. |
| codeSentMessage | Data Type: Text Value: I’ve sent you an email with a verification code. Please check your email and read the code back to me so we can get started. |
| customerType | Data Type: Text Value: Contact |
Elements
| Flow Element | Configuration |
|---|---|
| Start > + Decision | Label: Is Phone Provided? Outcome Label: Yes Filter: All Conditions Are Met (AND) Resource: incomingPhoneNumber, Operator: Is Null, Value: False Resource: incomingPhoneNumber, Operator: Does Not Equal, Value: Blank Value (Empty String) Default Outcome Label: No (Default) |
| No > + Assignment | Label: Assign Message for No Phone Number Variable: verificationCode, Operator: Equals, Value: codeNotSentMessage |
| Assignment > + End | N/A |
| Yes > + Get Records | Label: Get Contact By Phone Number Salesforce Object: Contact Filter: All Conditions Are Met (AND) Field: Mobile Phone, Operator: Equals, Value: incomingPhoneNumber |
| + Decision | Label: Has Contact? Outcome Label: Yes Filter: All Conditions Are Met (AND) Resource: Contact from Get Contact By Phone Number > Contact ID, Operator: Is Null, Value: False Default Outcome Label: No (Default) |
| No > + Assignment | Label: Assign Message for No Contact Variable: verificationCode, Operator: Equals, Value: codeNotSentMessage |
| Assignment > + End | N/A |
| Yes > + Assignment | Label: Assign Contact Values Variable: customerId, Operator: Equals, Value: Contact from Get Contact By Phone Number > Contact ID Variable: customerType, Operator: Equals, Value: customerType Variable: customerEmail, Operator: Equals, Value: Contact from Get Contact By Phone Number > Email |
| + Decision | Label: Has Email Address? Outcome Label: Yes Filter: All Conditions Are Met (AND) Resource: customerEmail, Operator: Is Null, Value: False Default Outcome Label: No (Default) |
| No > + Assignment | Label: Assign Message for No Email Address Variable: verificationCode, Operator: Equals, Value: codeNotSentMessage |
| Assignment > + End | N/A |
| Yes > + Action | Action: Generate verification code Label: Generate Verification Code |
| + Action | Action: Send Email Label: Email Verification Code Recipient Addresses: customerEmail SenderType: OrgWideEmailAddress SenderEmailAddress: Enter the email address from which the email is sent Subject: Your Verification Code Body: Enter this message: To verify your email address, read out this verification code to the agent: Insert this resource at the end of the message: Outputs from Generate Verification Code > The six digit generated verification code |
| Assignment | Label: Assign Verification Code Variable: verificationCode, Operator: Equals, Value: Outputs from Generate Verification Code > The six digit generated verification code Variable: authenticationKey, Operator: Equals, Value: Outputs from Generate Verification Code > Authentication Key |
When you’ve completed the flow, save and activate it. Your flow should look like this.
Create the Agent Action
Create the agent action and assign the referenced flow to it.
- In Setup, find and select Agentforce Assets.
- From the Actions tab, click New Agent Action.
- For Reference Action Type, select Flow.
- For Reference Action, select the flow that you created. By default, the action gets the name of the flow — Send Verification Code for Voice.
- For Agent Action Description, enter: Sends a generated verification code to the existing user’s email address, taken from the contact record that’s associated with the phone number retrieved from the incoming call.
- For Loading Text, enter Default.
- For the input, don’t mark it as required and enter this description: Stores the customer’s phone number. This input initiates the verification process.
-
For the outputs, don’t select Show in conversation and enter these descriptions:
- authenticationKey: The authentication key that’s used to generate the verification code.
- customerEmail: The email address retrieved from the Contact record.
- customerId: The Salesforce user ID or contact ID.
- customerIdType: The type of ID used in customerId. Can either be userId or contactId.
- verificationCode: The generated verification code.
- verificationMessage: A generic message that’s given to the user.
- Click Finish.
Create the Subagent
Enter the required details for the subagent and the relevant agent actions.
- In Setup, find and select Agentforce Assets.
- From the Subagents tab, click New Subagent.
- Enter a name, for example Customer Verification for Voice.
- For Classification Description, enter: Verifies the customer’s identity before scheduling a repair, scheduling maintenance, scheduling an installation, or granting access to sensitive data, service appointments, appointment booking, or providing any service to a customer. Sensitive data includes confidential, private, or security-protected information, such as business-critical data, personally identifiable information (PII). After verification is successful, don’t repeat the process within the same session.
- For Scope, enter: Your job is to authenticate the customer who has not yet been authenticated before granting access to any sensitive data, scheduling appointments, booking appointments, or providing any customer service (Vacuum cleaning, TV fix, etc.). You will verify the customer using their phone number only. Never ask for an email address or username. After verification is successful, don’t repeat the process within the same session.
-
Enter these instructions:
Instruction 1: The very first action you MUST take when this subagent is activated — before saying anything to the customer is to invoke the "Send Verification Code for Voice" action without asking the customer for any information. Use the "incomingPhoneNumber" value from the conversation as input. This is mandatory and must happen every single time, with no exceptions. Do not greet the customer, do not ask any questions, and do not wait — invoke the action immediately and silently first.
Instruction 2: After invoking the action, say the exact value of the "verificationMessage" field returned by the action to the customer. Do not add, change, or interpret the message in any way. Do not mention phone, SMS, or text message — the code is sent by email only. Only say what the "verificationMessage" output returns, word for word.
Instruction 3: If the customer enters the wrong verification code three times, automatically invoke the "Send Verification Code for Voice" action again using the same phone number (incomingPhoneNumber) to send a new code. Do not ask for an email address or username under any circumstances — always use the phone number only.
Instruction 4: Never process any request for accessing or updating sensitive data without first completing this verification flow. If the customer is not yet verified, always invoke the "Send Verification Code for Voice" action before proceeding.
Instruction 5: Never reveal the verification code or any internal system values to the customer. Keep all verification details confidential.
Instruction 6: After the user is verified in a conversation session, switching to a different user is not allowed under any circumstances.
Instruction 7: If verification is successful, immediately proceed with the action the user originally intended to perform — do not ask them to repeat their request if it was already stated.
- Click Next.
-
Add these actions to the subagent:
- Send Verification Code for Voice (the action that you created)
- Verify Customer for Field Service (standard action)
- Click Finish.

