Nachverfolgen bestimmter Datenprivatsphäre-Voreinstellungen für Leads und Kontakte, die bereits in Salesforce gespeichert sind
Erstellen Sie Datenprivatsphäre-Datensätze anhand des Objekts "Einzelperson" für Leads und Kontakte, die bereits in Salesforce gespeichert sind, indem Sie Skripte verwenden.
Erforderliche Editionen
Verfügbarkeit: Salesforce Classic und Lightning Experience
Verfügbarkeit: Alle Editionen, einschließlich der Partner- und Kunden-Community-Benutzer.
Mit diesen Skripten werden eindeutige Datenprivatsphäre-Datensätze für jeden Lead und Kontakt erstellt. Beachten Sie, dass mit diesem Skript doppelte Datensätze angelegt werden, wenn Sie bereits Datenprivatsphäre-Datensätze für Leads und Kontakte besitzen.
Erstellen von Datenprivatsphäre-Datensätzen für Kontakte
Erstellen Sie Datenprivatsphäre-Datensätze und verknüpfen Sie sie mit bereits in Salesforce vorhandenen Kontakten, indem Sie dieses Skript ausführen.
global class CreateIndividualFromContact implements Database.Batchable<sObject> {
global Database.Querylocator start(Database.BatchableContext BC) {
//Query to fetch contacts that don't have Individual created. You may modify the query to add custom fields
//Please add "IsPersonAccount = false" condition to below query to exclude person accounts
return Database.getQueryLocator('Select FirstName, LastName, Salutation from Contact where IndividualId = NULL');
}
global void execute(Database.BatchableContext BC, List<Contact> contactList) {
Map<Id, Individual> individualRecordsToCreate = new Map<Id, Individual>();
for(Contact con : contactList) {
individualRecordsToCreate.put(con.Id, new Individual(FirstName = con.FirstName, LastName = con.LastName, Salutation=con.Salutation));
}
insert individualRecordsToCreate.values();
for(Contact con : contactList) {
con.IndividualId = individualRecordsToCreate.get(con.Id).Id;
}
update contactList;
}
global void finish(Database.BatchableContext BC) {}
}
Erstellen von Datenprivatsphäre-Datensätzen für Leads
Erstellen Sie Datenprivatsphäre-Datensätze und verknüpfen Sie sie mit bereits in Salesforce vorhandenen Leads, indem Sie dieses Skript ausführen.
global class CreateIndividualFromLead implements Database.Batchable<sObject> {
global Database.Querylocator start(Database.BatchableContext BC) {
//Query to fetch non-converted Leads that don't have Individual created. You may modify the query to add custom fields
return Database.getQueryLocator('Select FirstName, LastName, Salutation from Lead where IsConverted = false and IndividualId = NULL');
}
global void execute(Database.BatchableContext BC, List<Lead> leadList) {
Map<Id, Individual> individualRecordsToCreate = new Map<Id, Individual>();
for(Lead l : leadList) {
individualRecordsToCreate.put(l.Id, new Individual(FirstName = l.FirstName, LastName = l.LastName, Salutation=l.Salutation));
}
insert individualRecordsToCreate.values();
for(Lead l : leadList) {
l.IndividualId = individualRecordsToCreate.get(l.Id).Id;
}
update leadList;
}
global void finish(Database.BatchableContext BC) {}
}
Konnten Sie Ihr Problem mithilfe dieses Artikels lösen?
Geben Sie uns Feedback, damit wir uns verbessern können.
Laden
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.