Set Up Customer-Initiated Scheduling with Email in the Legacy Agentforce Builder

Set up a Customer-Initiated Scheduling agent that connects to email.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions with Field Service and Foundations. Also available with Einstein 1 Field Service Edition or Agentforce 1 Field Service Edition.

Now that you’ve set up Email-to-Case and reviewed the information about getting started with Autonomous Scheduling, you’re ready to set up an agent that connects to email.

Note
Note Starting the week of July 13, 2026, you can no longer create agents in the legacy Agentforce Builder. To complete this implementation, use an existing legacy agent and modify it.

Create a Flow

Create a flow that maps the end user’s contact ID to the contactID variable.

  1. In Setup, find and select Flows.
  2. Click New Flow.
  3. Select Autolaunched Flow (No Trigger).
  4. In Flow Builder, open the Toolbox.
  5. Click New Resource.
  6. Create these variables.
    • API Name: endUserContactId

      Data Type: Text

      Available for input

    • API Name: contactId

      Data Type: Text

      Available for output

  7. After the Start element, add an Assignment element.
    • Label: Assign Contact ID from End User Contact ID
    • Variable: contactId, Operator: Equals, Value: endUserContactId
    Assignment element in Flow Builder
  8. Save the flow.
  9. Give the flow a name, for example, enter Field Service: Map End User Contact ID to Contact ID.
  10. Activate the flow.

Create the Context Variable

Create a context variable to store the end user's contact ID.

  1. In Setup, find and select Agentforce Agents.
  2. Open the agent that you created.
  3. Click Open in Builder.
  4. In Agentforce Builder, click Context.
  5. Click New Variable.
  6. Enter these details.
    • Name: endUserContactId
    • Data Type: Text
    • Allow value to be set by API
    • Allow LLM to use this value

Create an Action

Create an action that maps the contact ID variables.

  1. In Agentforce Builder, click Subagents and open the Appointment Management for Field Service subagent.
  2. Click This Subagent’s Actions.
  3. Click New and select Create New Action.
  4. For Reference Action Type, select Flow.
  5. Select the flow that you created. By default, the action gets the name of the flow — Field Service: Map End User Contact ID to Contact ID.
  6. Click Next.
  7. For Agent Action Description, enter: Maps the endUserContactId to the contactId variable.
  8. Complete the rest of the mandatory fields and click Finish.
  9. From the list of actions, open the action that you created.
  10. Click Edit Action.
  11. Assign these variables.
    • endUserContactId input — assign the endUserContactId variable
    • contactID output — assign the VerifiedCustomerID variable
    Assign variables in action
  12. Save the action.

Update the Agent Instructions

Update the agent instructions to call the contact ID mapping action.

  1. In the Appointment Management for Field Service subagent, click Subagent Configuration.
  2. Modify the guidelines for scheduling an appointment.
    1. Search for this sentence: Do not begin scheduling until the purpose of the service appointment is stated.
    2. Add this sentence before it: You must call the "Field Service: Map End User Contact ID to Contact ID" action.
  3. Modify the guidelines for rescheduling an appointment.
    1. Search for this sentence: You must call the "Update Appointment Times for Field Service" with the appointment’s ID and without arrival window start and arrival window end parameters.
    2. Add this sentence before it: You must call the "Field Service: Map End User Contact ID to Contact ID" action.
  4. Modify the guidelines for getting information about an appointment.
    1. Search for this sentence: This instruction governs how to retrieve, filter, format, and display appointment information to the customer using the "Get Appointment Information for Field Service" action.
    2. Add this sentence at the top of the Critical Restrictions: You must call the "Field Service: Map End User Contact ID to Contact ID" action to ground the contact ID before calling the "Get Appointment Information for Field Service" action.
  5. Modify the guidelines for canceling an appointment.
    1. Search for this sentence: Manages the process of canceling a customer’s service appointment.
    2. Add this step after the first step: You must call the "Field Service: Map End User Contact ID to Contact ID" action to ground the contact ID.
  6. Activate the agent.