Använd Apex för att välja en lista över butiker som du vill att Einstein ska skapa besöksrekommendationer för. När du har skapat en Apex-åtgärd använder du komponenten Skapa i strategin för att välja Apex-åtgärden.
Versioner som krävs
Tillgängliga i: Professional, Enterprise och Unlimited Editions som har Consumer Goods Cloud aktiverat.
Anteckning Vi rekommenderar att du använder komponenten Skapa för att läsa in data. När du använder komponenten Skapa kan du kringgå överföringsgränserna som angivits av Salesforce Governor.
Viktig För att använda en Apex-åtgärd i en strategi, be din utvecklare annotera en lämplig metod med @InvocableMethod.
Så här ser en Apex-klass för butiksfiltrering ut:
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;
}
}
När du har angivit Apex-åtgärden i strategin anger du etiketten för den åberopbara variabeln som parametern för Apex-åtgärden. I komponenten Karta i strategin mappar du parametern med ID för de butiker som du vill se besöksrekommendationer för. Butikernas ID måste anges med dubbla citattecken i en kommaseparerad lista.
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.