Skip to content

Commit 389f219

Browse files
authored
Merge pull request #333 from SFDO-Community-Sprints/metecho/enable-lead-matching
Metecho/enable lead matching
2 parents d859219 + 6821c42 commit 389f219

File tree

39 files changed

+1294
-34
lines changed

39 files changed

+1294
-34
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
public class SummitEventsAfterLeadConversion {
2+
public static void afterUpdate(List<Lead> newLeads) {
3+
updateEventsOnConvert(newLeads);
4+
}
5+
6+
static void updateEventsOnConvert(List<Lead> newLeads) {
7+
List<Lead> converted = new List<Lead>();
8+
for (Lead l : newLeads) {
9+
if (l.IsConverted) {
10+
converted.add(l);
11+
}
12+
}
13+
14+
if (!converted.isEmpty()) {
15+
List<Summit_Events_Registration__c> registrations = [
16+
SELECT Id, Lead__c, Matching_Log__c
17+
FROM Summit_Events_Registration__c
18+
WHERE Lead__c IN :converted AND Contact__c = NULL
19+
];
20+
Map<Id, Lead> leadMap = new Map<Id, Lead>(converted);
21+
22+
for (Summit_Events_Registration__c reg : registrations) {
23+
reg.Contact__c = leadMap.get(reg.Lead__c).ConvertedContactId;
24+
reg.Matching_Log__c += '<hr>Lead converted to Contact - ' + System.now();
25+
}
26+
27+
update registrations;
28+
}
29+
}
30+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<apiVersion>52.0</apiVersion>
4+
<status>Active</status>
5+
</ApexClass>

force-app/main/default/classes/SummitEventsContactMatching.cls

Lines changed: 307 additions & 23 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Layout xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<layoutSections>
4+
<customLabel>false</customLabel>
5+
<detailHeading>false</detailHeading>
6+
<editHeading>true</editHeading>
7+
<label>Information</label>
8+
<layoutColumns>
9+
<layoutItems>
10+
<behavior>Required</behavior>
11+
<field>MasterLabel</field>
12+
</layoutItems>
13+
<layoutItems>
14+
<behavior>Required</behavior>
15+
<field>Source_Type__c</field>
16+
</layoutItems>
17+
<layoutItems>
18+
<behavior>Edit</behavior>
19+
<field>Source_Object__c</field>
20+
</layoutItems>
21+
<layoutItems>
22+
<behavior>Required</behavior>
23+
<field>Source_Value__c</field>
24+
</layoutItems>
25+
<layoutItems>
26+
<behavior>Required</behavior>
27+
<field>Lead_Field_API_Name__c</field>
28+
</layoutItems>
29+
</layoutColumns>
30+
<layoutColumns>
31+
<layoutItems>
32+
<behavior>Required</behavior>
33+
<field>DeveloperName</field>
34+
</layoutItems>
35+
<layoutItems>
36+
<behavior>Edit</behavior>
37+
<field>IsProtected</field>
38+
</layoutItems>
39+
<layoutItems>
40+
<behavior>Required</behavior>
41+
<field>NamespacePrefix</field>
42+
</layoutItems>
43+
<layoutItems>
44+
<behavior>Required</behavior>
45+
<field>Lead_Matching_Method__c</field>
46+
</layoutItems>
47+
<layoutItems>
48+
<behavior>Edit</behavior>
49+
<field>Matching_Only__c</field>
50+
</layoutItems>
51+
</layoutColumns>
52+
<style>TwoColumnsTopToBottom</style>
53+
</layoutSections>
54+
<layoutSections>
55+
<customLabel>false</customLabel>
56+
<detailHeading>false</detailHeading>
57+
<editHeading>true</editHeading>
58+
<label>System Information</label>
59+
<layoutColumns>
60+
<layoutItems>
61+
<behavior>Readonly</behavior>
62+
<field>CreatedById</field>
63+
</layoutItems>
64+
</layoutColumns>
65+
<layoutColumns>
66+
<layoutItems>
67+
<behavior>Readonly</behavior>
68+
<field>LastModifiedById</field>
69+
</layoutItems>
70+
</layoutColumns>
71+
<style>TwoColumnsTopToBottom</style>
72+
</layoutSections>
73+
<layoutSections>
74+
<customLabel>true</customLabel>
75+
<detailHeading>true</detailHeading>
76+
<editHeading>false</editHeading>
77+
<label>Custom Links</label>
78+
<layoutColumns/>
79+
<layoutColumns/>
80+
<layoutColumns/>
81+
<style>CustomLinks</style>
82+
</layoutSections>
83+
<showEmailCheckbox>false</showEmailCheckbox>
84+
<showHighlightsPanel>false</showHighlightsPanel>
85+
<showInteractionLogPanel>false</showInteractionLogPanel>
86+
<showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
87+
<showSubmitAndAttachButton>false</showSubmitAndAttachButton>
88+
<summaryLayout>
89+
<masterLabel>00h17000007jTJq</masterLabel>
90+
<sizeX>4</sizeX>
91+
<sizeY>0</sizeY>
92+
<summaryLayoutStyle>Default</summaryLayoutStyle>
93+
</summaryLayout>
94+
</Layout>

force-app/main/default/layouts/Summit_Events_Registration__c-Summit Events Registration Default Layout.layout-meta.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<field>Contact__c</field>
1717
</layoutItems>
1818
<layoutItems>
19-
<emptySpace>true</emptySpace>
19+
<behavior>Edit</behavior>
20+
<field>Lead__c</field>
2021
</layoutItems>
2122
<layoutItems>
2223
<behavior>Edit</behavior>
@@ -218,6 +219,10 @@
218219
<behavior>Edit</behavior>
219220
<field>New_Contact_Created__c</field>
220221
</layoutItems>
222+
<layoutItems>
223+
<behavior>Edit</behavior>
224+
<field>New_Lead_Created__c</field>
225+
</layoutItems>
221226
<layoutItems>
222227
<behavior>Edit</behavior>
223228
<field>Matching_Log__c</field>
@@ -673,7 +678,7 @@
673678
<showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
674679
<showSubmitAndAttachButton>false</showSubmitAndAttachButton>
675680
<summaryLayout>
676-
<masterLabel>00h1D000003cIzE</masterLabel>
681+
<masterLabel>00h17000007jSEu</masterLabel>
677682
<sizeX>4</sizeX>
678683
<sizeY>0</sizeY>
679684
<summaryLayoutStyle>Default</summaryLayoutStyle>

force-app/main/default/layouts/Summit_Events__c-Summit Event Default Layout.layout-meta.xml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,41 @@
498498
</layoutColumns>
499499
<style>TwoColumnsLeftToRight</style>
500500
</layoutSections>
501+
<layoutSections>
502+
<customLabel>true</customLabel>
503+
<detailHeading>true</detailHeading>
504+
<editHeading>true</editHeading>
505+
<label>Lead Matching</label>
506+
<layoutColumns>
507+
<layoutItems>
508+
<behavior>Edit</behavior>
509+
<field>Lead_matching_rules__c</field>
510+
</layoutItems>
511+
<layoutItems>
512+
<behavior>Edit</behavior>
513+
<field>Lead_Creation_Duplicate_Rule__c</field>
514+
</layoutItems>
515+
<layoutItems>
516+
<behavior>Edit</behavior>
517+
<field>Custom_Metadata_Lead_Matching_Method__c</field>
518+
</layoutItems>
519+
</layoutColumns>
520+
<layoutColumns>
521+
<layoutItems>
522+
<behavior>Readonly</behavior>
523+
<field>Lead_Matching_Rule_Description__c</field>
524+
</layoutItems>
525+
<layoutItems>
526+
<behavior>Edit</behavior>
527+
<field>Lead_Matching_No_Match_Behavior__c</field>
528+
</layoutItems>
529+
<layoutItems>
530+
<behavior>Edit</behavior>
531+
<field>Lead_Matching_Multiple_Match_Behavior__c</field>
532+
</layoutItems>
533+
</layoutColumns>
534+
<style>TwoColumnsLeftToRight</style>
535+
</layoutSections>
501536
<layoutSections>
502537
<customLabel>false</customLabel>
503538
<detailHeading>true</detailHeading>
@@ -537,6 +572,11 @@
537572
</miniLayout>
538573
<platformActionList>
539574
<actionListContext>Record</actionListContext>
575+
<platformActionListItems>
576+
<actionName>Clone</actionName>
577+
<actionType>StandardButton</actionType>
578+
<sortOrder>2</sortOrder>
579+
</platformActionListItems>
540580
<platformActionListItems>
541581
<actionName>Edit</actionName>
542582
<actionType>StandardButton</actionType>
@@ -547,11 +587,6 @@
547587
<actionType>StandardButton</actionType>
548588
<sortOrder>1</sortOrder>
549589
</platformActionListItems>
550-
<platformActionListItems>
551-
<actionName>Clone</actionName>
552-
<actionType>StandardButton</actionType>
553-
<sortOrder>2</sortOrder>
554-
</platformActionListItems>
555590
</platformActionList>
556591
<relatedLists>
557592
<fields>NAME</fields>
@@ -618,7 +653,7 @@
618653
<showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
619654
<showSubmitAndAttachButton>false</showSubmitAndAttachButton>
620655
<summaryLayout>
621-
<masterLabel>00h1D0000045UfG</masterLabel>
656+
<masterLabel>00h17000007jSSZ</masterLabel>
622657
<sizeX>4</sizeX>
623658
<sizeY>0</sizeY>
624659
<summaryLayoutStyle>Default</summaryLayoutStyle>

force-app/main/default/objects/Summit_Events_Contact_Matching_Mapping__mdt/fields/Contact_Matching_Method__c.field-meta.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,32 @@
99
<valueSet>
1010
<restricted>true</restricted>
1111
<valueSetDefinition>
12-
<sorted>false</sorted>
12+
<sorted>true</sorted>
1313
<value>
1414
<fullName>Admissions</fullName>
1515
<default>false</default>
1616
<label>Admissions</label>
1717
</value>
18+
<value>
19+
<fullName>Blue</fullName>
20+
<default>true</default>
21+
<label>Blue</label>
22+
</value>
23+
<value>
24+
<fullName>Green</fullName>
25+
<default>false</default>
26+
<label>Green</label>
27+
</value>
28+
<value>
29+
<fullName>Red</fullName>
30+
<default>false</default>
31+
<label>Red</label>
32+
</value>
33+
<value>
34+
<fullName>Yellow</fullName>
35+
<default>false</default>
36+
<label>Yellow</label>
37+
</value>
1838
</valueSetDefinition>
1939
</valueSet>
2040
</CustomField>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<label>Summit Events Lead Matching Mapping</label>
4+
<pluralLabel>Summit Events Lead Matching Mappings</pluralLabel>
5+
<visibility>Public</visibility>
6+
</CustomObject>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<fullName>Lead_Field_API_Name__c</fullName>
4+
<externalId>false</externalId>
5+
<fieldManageability>DeveloperControlled</fieldManageability>
6+
<label>Lead Field API Name</label>
7+
<length>255</length>
8+
<required>true</required>
9+
<type>Text</type>
10+
<unique>false</unique>
11+
</CustomField>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<fullName>Lead_Matching_Method__c</fullName>
4+
<externalId>false</externalId>
5+
<fieldManageability>DeveloperControlled</fieldManageability>
6+
<label>Lead Matching Method</label>
7+
<required>true</required>
8+
<type>Picklist</type>
9+
<valueSet>
10+
<restricted>true</restricted>
11+
<valueSetDefinition>
12+
<sorted>true</sorted>
13+
<value>
14+
<fullName>Blue</fullName>
15+
<default>true</default>
16+
<label>Blue</label>
17+
</value>
18+
<value>
19+
<fullName>Green</fullName>
20+
<default>false</default>
21+
<label>Green</label>
22+
</value>
23+
<value>
24+
<fullName>Red</fullName>
25+
<default>false</default>
26+
<label>Red</label>
27+
</value>
28+
<value>
29+
<fullName>Yellow</fullName>
30+
<default>false</default>
31+
<label>Yellow</label>
32+
</value>
33+
</valueSetDefinition>
34+
</valueSet>
35+
</CustomField>

0 commit comments

Comments
 (0)