Отслеживание определенных параметров конфиденциальности данных для интересов и контактов, уже находящихся в Salesforce
Создайте записи конфиденциальности данных на основе объекта «Отдельное лицо» для интересов и контактов, уже находящихся в Salesforce, посредством сценариев.
Требуемые версии
Доступно в версиях: Salesforce Classic и Lightning Experience
Доступно в версиях: все выпуски, включительно с пользователями партнерских и клиентских сообществ.
Эти сценарии создают уникальные записи конфиденциальности данных для каждого интереса и контакта. Помните, что если у вас уже есть записи о конфиденциальности данных для интересов и контактов, этот сценарий создает повторяющиеся записи.
Создание записей о конфиденциальности данных для контактов
Создайте записи о конфиденциальности данных и свяжите их с контактами, уже находящимися в Salesforce при запуске данного сценария.
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) {}
}
Создание записей о конфиденциальности данных для интересов
Создайте записи о конфиденциальности данных и свяжите их с интересами, уже находящимися в Salesforce при запуске данного сценария.
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) {}
}
Эта статья решила вашу проблему?
Оставьте свой отзыв, чтобы мы могли стать лучше!
Загрузка
Salesforce Help | Article
Cookie Consent Manager
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.