Gebruik Apex om een lijst van stores te selecteren, waarvoor u Einstein aanbevelingen voor bezoeken wilt laten geven. Nadat u een Apex-actie hebt gemaakt, gebruikt u het element Genereren in uw strategie om de Apex-actie te selecteren.
Vereiste editions
Beschikbaar in: Professional, Enterprise en Unlimited Edition waarin Consumer Goods Cloud is ingeschakeld.
Opmerking U wordt aangeraden om het element Genereren te gebruiken om de gegevens te laden. Het gebruik van het element Genereren omzeilt transactiegebonden limieten die worden opgelegd door de Salesforce-beheerder.
Belangrijk Vraag voor het gebruik van een Apex-actie in een strategie uw ontwikkelaar om de juiste methode te annoteren met @InvocableMethod.
Een Apex-klasse voor het filteren van stores ziet er zo uit:
global class LoadStores {
global class RecommendationRequest {
@InvocableVariable(label='Store Ids')
public String siteIds;
}
@InvocableMethod(label='Get Stores from Request' description='Gets stores that are chosen in the request')
public static List<List<Recommendation>> getVisits(List<RecommendationRequest> requests) {
List<List<Recommendation>> recos = new List<List<Recommendation>>();
for(RecommendationRequest request : requests){
List<Recommendation> output = new List<Recommendation>();
List<String> siteList = request.siteIds.split(',');
List<RetailStore> stores = [SELECT Id, Name FROM RetailStore WHERE Id IN :siteList];
for(RetailStore store : stores){
Recommendation rec = new Recommendation(
Name = store.Name,
Description = store.Name,
ExternalId = store.Id
);
output.add(rec);
}
recos.add(output);
}
return recos;
}
}
Nadat u de Apex-actie in de strategie hebt opgegeven, geeft u het label van de aanroepbare variabele op als parameter voor de Apex-actie. Wijs in het element Toewijzen van uw strategie de parameter met de ID van de stores toe, waarvoor u aanbevelingen voor bezoeken wenst. De store-ID's moeten worden opgegeven tussen dubbele aanhalingstekens in een met komma's gescheiden lijst.
Laat ons weten wat we kunnen doen om te verbeteren!
Wordt geladen
Salesforce Help | Article
Cookie Consent Manager
General Information
Required Cookies
Functional Cookies
Advertising Cookies
General Information
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.