Eksempel: Apex-klasse for tidsvælgermeddelelseskomponenter
Meddelelseskomponenter for tidsvælger sender kunder en meddelelse og en liste over tilgængelige tidsintervaller, som de kan vælge blandt. Hvis du vil generere listen over tidsintervaller, hver gang komponenten sendes, skal du oprette en Apex-klasse. Apex-klassen bestemmer startklokkeslett, varighet og tidssone for tidsluken.
Forbedret chat i app, Forbedret nettchat v1, Forbedret WhatsApp, Forbedret Facebook Messenger og Forbedrede Apple-meldinger for virksomheter og Ta med din egen kanal
Denne artikkelen gjelder ikke for:
Forbedret Web Chat v2, Standard Facebook Messenger, Standard og forbedret SMS og Forbedret LINE
Denne Apex-klassen gir eksempler på tidsluker i flere intervaller, hver satt av et par Datetime-setninger.
Eksempel
public with sharing class MessagingTimeSlotOptions {
@InvocableMethod
public static List<List<RichMessaging.TimeSlotOption>> getTimeSlotOptions(){
List<List<RichMessaging.TimeSlotOption>> result = new List<List<RichMessaging.TimeSlotOption>>();
List<RichMessaging.TimeSlotOption> options = new List<RichMessaging.TimeSlotOption>{
new RichMessaging.TimeSlotOption(
Datetime.now().addHours(1),
Datetime.now().addHours(2)),
new RichMessaging.TimeSlotOption(
Datetime.now().addHours(3),
Datetime.now().addHours(4)),
new RichMessaging.TimeSlotOption(
Datetime.now().addHours(25),
Datetime.now().addHours(26)),
new RichMessaging.TimeSlotOption(
Datetime.now().addHours(27),
Datetime.now().addHours(28))
};
result.add(options);
return result;
}
}
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.