Loading
Agentforce and Einstein Generative AI
Innhold
Velg filtre

          Ingen resultater
          Ingen resultater
          Her er noen søketips

          Kontroller stavemåten i søkeordene.
          Bruk mer generelle søkebegreper.
          Velg færre filtre for å utvide søket.

          Søk i all Salesforce Hjelp
          Adaptive Response Format: Time Picker

          Adaptive Response Format: Time Picker

          A time picker response is a list of available time slots. Currently, time picker response is available for Agentforce Service Agent only.

          Required Editions

          Available in: Lightning Experience
          Available in: Enterprise, Performance, Unlimited, and Developer Editions with Foundations, or Agentforce 1 or Einstein 1 Editions

          Adaptive Response Format Details

          Mapped messaging component Time selector
          Supported channels Enhanced Apple Messages for Business

          Considerations

          • You can't customize the mapped messaging component in Messaging Component Builder.
          • The time picker response supports the Time Selector messaging component format for enhanced Apple Messages for Business channels. On Enhanced Chat channels, time slots appear as buttons.

          To use the time picker format in agent responses, create a custom agent action that returns the required information. For a sample reference action, see the example Apex class.

          Time Slots
          A list of available time slots.
          Message
          Optional. Text sent immediately before the time picker. For example, "Here are the available time slots."
          Reply
          Optional. Text sent after the customer selects a time slot. For example, "Thank you for selecting your preferred time slot."
          Location Name
          Optional. Name of the location associated with the time slots. For example, "Main Office."
          Latitude
          Optional. Latitude of the location.
          Longitude
          Optional. Longitude of the location.
          Radius
          Optional. Radius of the location area in meters.

          The Location Name, Latitude, and Longitude fields must be included together.

          This Apex class retrieves available time slots for a specified day. It returns the time slots as a list.

          Example
          Example
          public class TimePickerResponse {
          
              @InvocableVariable(label='Time Slots')
              public List<String> timeSlots;
          
              @InvocableVariable(label='Message')
              public String message;
          
              public TimePickerResponse() {
                  this.message = 'Here are the available time slots:';
                  this.timeSlots = new List<String>();
              }
          
              @InvocableMethod(
                  label='Get Time Slots by Day Name'
                  description='Returns time slots as plain text based on the specified days.'
              )
              public static List<List<String>> getAvailableTimesForDay(List<String> dayNames) {
          
                  List<List<String>> allAvailableTimes = new List<List<String>>();
          
                  for (String dayName : dayNames) {
          
                      List<String> availableTimes = new List<String>();
                      String normalizedDay = dayName.trim().toLowerCase();
          
                      switch on normalizedDay {
                          when 'monday' {
                              availableTimes.add('9:00 AM - 10:00 AM');
                              availableTimes.add('12:00 PM - 1:00 PM');
                              availableTimes.add('3:00 PM - 4:00 PM');
                          }
                          when 'tuesday' {
                              availableTimes.add('10:00 AM - 11:00 AM');
                              availableTimes.add('1:00 PM - 2:00 PM');
                              availableTimes.add('4:00 PM - 5:00 PM');
                          }
                          when 'wednesday' {
                              availableTimes.add('9:30 AM - 10:30 AM');
                              availableTimes.add('12:30 PM - 1:30 PM');
                              availableTimes.add('3:30 PM - 4:30 PM');
                          }
                          when 'thursday' {
                              availableTimes.add('8:00 AM - 9:00 AM');
                              availableTimes.add('11:00 AM - 12:00 PM');
                              availableTimes.add('2:00 PM - 3:00 PM');
                          }
                          when 'friday' {
                              availableTimes.add('9:00 AM - 10:00 AM');
                              availableTimes.add('11:30 AM - 12:30 PM');
                              availableTimes.add('2:00 PM - 3:00 PM');
                          }
                          when 'saturday' {
                              availableTimes.add('10:00 AM - 11:00 AM');
                              availableTimes.add('12:00 PM - 1:00 PM');
                              availableTimes.add('2:00 PM - 3:00 PM');
                          }
                          when 'sunday' {
                              availableTimes.add('11:00 AM - 12:00 PM');
                              availableTimes.add('1:00 PM - 2:00 PM');
                              availableTimes.add('3:00 PM - 4:00 PM');
                          }
                      }
                      allAvailableTimes.add(availableTimes);
                  }
          
                  return allAvailableTimes;
              }
          }
             
           
          Laster
          Salesforce Help | Article