You need to sign in to do that
Don't have an account?

merging two different contact child records in loyalty application
Hi All,
My Requirement is System Administrator going to merge two Different loyalty records in Loyalty application.
Contact- Parent Object
Loyalty- Child Object
Loyalty tier : Formula filed (
statement 1: =>150k,tier1
statement 2: >=85k && <150k ,tier2
statement 3: < $85K,tier 3 )
1. search criteria (Email or LoyaltyId or Contact name or Homephone or MobilePhone or etc)

.if i search with mail or mobile number or contact name in contact object . then i get child of loyalty records in table.
Search any two(or more) Contacts merged manually ,The loyalty object should be merged as well ,using the same logic that is currently in place for merging Contacts.
Merging Fields in Record::
Loyalty Sales Inclusion Value: saleslifetimevalue+ loyaltysalesinclusionvalue, ex : 0 + $95000= $ 95000
Saleslifetimevalue= Saleslifetimevalue (Record 1 )+ Saleslifetimevalue (Record 2 ) = $73000 + $ 95000 = $ 163000
Loyalty Life Time Value: Saleslifetimevalue+ loyaltysalesinclusionvalue=$ 163000 + 0 = $ 163000
PageBlock Table:

Scope:
New Contact: When a customer buys an Audi vehicle for the first time, the system should generate a unique Loyalty ID (LID) for the contact and the retail price of the vehicle shall determine the Loyalty tier for the new contact.
Existing Contact: When an existing customer purchases a 2 nd or subsequent Audi vehicles the retail price of the vehicle will increase the Loyalty life time spend of the contact which may lead to increase in their Loyalty tier based on the total lifetime spend of the contact.
Merging existing Contacts: When two (or more) Contacts are merged manually, the Loyalty Objects
should be merged as well, using the same logic that is currently in place for merging Contacts.
Loyalty Inclusion : Loyalty Inclusion nothing but checkbox validation .
if you give checkbox = true means the record is merged to other record.
else checkbox = false means the record is override based on other record.
A Checkbox in Loyalty object traced to the checkbox in Loyalty application identifying
Scenario1 : A new customer purchases a vehicle for $73,800 – new contact created:
Contact name: Sasidhar
Loyalty Id : AC00061 (unique Id)
SaleslifeTime Value : $90,000
Loyalty Sales Inclusion Value: $0
Loyalty Life Time Value : Sales Lifetime Value + Loyalty Sales Inclusion Value = $90,000+ $0 = $90,000
Loyalty tier determined: Tier 2 (< $85K)
Purchased Vehicles = 1
Purchased Vehicles Inclusion = 0
Loyalty Vehicles: Purchased Vehicles + Purchased Vehicles Inclusion = 1 + 0 = 1
Loyalty Overwrite date = Null
Scenario 2: Existing customer purchased a 2 nd vehicle for $90,000 -existing contact:
Contact name: Sehwag
Loyalty Id : AC00050 (unique Id)
Sales Lifetime Value: $73,800 + $90,000= $163,800
Loyalty Sales Inclusion Value: $0 + SaleslifeTime Value : $73,800
Loyalty Lifetime Value: Sales Lifetime Value + Loyalty Sales Inclusion Value = $163,800+ $0 = $163,800
4. Loyalty tier determined: Tier 1 (<= $150K)
5. Purchased Vehicles = 2
6. Purchased Vehicles Inclusion = 0
7. Loyalty Vehicles: Purchased Vehicles+ Purchased Vehicles Inclusion = 2 + 0 = 2
8 . Loyalty Overwrite date = Null
Finally Expecting result is :

My Requirement is System Administrator going to merge two Different loyalty records in Loyalty application.
Contact- Parent Object
Loyalty- Child Object
Loyalty tier : Formula filed (
statement 1: =>150k,tier1
statement 2: >=85k && <150k ,tier2
statement 3: < $85K,tier 3 )
1. search criteria (Email or LoyaltyId or Contact name or Homephone or MobilePhone or etc)
.if i search with mail or mobile number or contact name in contact object . then i get child of loyalty records in table.
Search any two(or more) Contacts merged manually ,The loyalty object should be merged as well ,using the same logic that is currently in place for merging Contacts.
Merging Fields in Record::
Loyalty Sales Inclusion Value: saleslifetimevalue+ loyaltysalesinclusionvalue, ex : 0 + $95000= $ 95000
Saleslifetimevalue= Saleslifetimevalue (Record 1 )+ Saleslifetimevalue (Record 2 ) = $73000 + $ 95000 = $ 163000
Loyalty Life Time Value: Saleslifetimevalue+ loyaltysalesinclusionvalue=$ 163000 + 0 = $ 163000
PageBlock Table:
Scope:
New Contact: When a customer buys an Audi vehicle for the first time, the system should generate a unique Loyalty ID (LID) for the contact and the retail price of the vehicle shall determine the Loyalty tier for the new contact.
Existing Contact: When an existing customer purchases a 2 nd or subsequent Audi vehicles the retail price of the vehicle will increase the Loyalty life time spend of the contact which may lead to increase in their Loyalty tier based on the total lifetime spend of the contact.
Merging existing Contacts: When two (or more) Contacts are merged manually, the Loyalty Objects
should be merged as well, using the same logic that is currently in place for merging Contacts.
Loyalty Inclusion : Loyalty Inclusion nothing but checkbox validation .
if you give checkbox = true means the record is merged to other record.
else checkbox = false means the record is override based on other record.
A Checkbox in Loyalty object traced to the checkbox in Loyalty application identifying
Scenario1 : A new customer purchases a vehicle for $73,800 – new contact created:
Contact name: Sasidhar
Loyalty Id : AC00061 (unique Id)
SaleslifeTime Value : $90,000
Loyalty Sales Inclusion Value: $0
Loyalty Life Time Value : Sales Lifetime Value + Loyalty Sales Inclusion Value = $90,000+ $0 = $90,000
Loyalty tier determined: Tier 2 (< $85K)
Purchased Vehicles = 1
Purchased Vehicles Inclusion = 0
Loyalty Vehicles: Purchased Vehicles + Purchased Vehicles Inclusion = 1 + 0 = 1
Loyalty Overwrite date = Null
Scenario 2: Existing customer purchased a 2 nd vehicle for $90,000 -existing contact:
Contact name: Sehwag
Loyalty Id : AC00050 (unique Id)
Sales Lifetime Value: $73,800 + $90,000= $163,800
Loyalty Sales Inclusion Value: $0 + SaleslifeTime Value : $73,800
Loyalty Lifetime Value: Sales Lifetime Value + Loyalty Sales Inclusion Value = $163,800+ $0 = $163,800
4. Loyalty tier determined: Tier 1 (<= $150K)
5. Purchased Vehicles = 2
6. Purchased Vehicles Inclusion = 0
7. Loyalty Vehicles: Purchased Vehicles+ Purchased Vehicles Inclusion = 2 + 0 = 2
8 . Loyalty Overwrite date = Null
Finally Expecting result is :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_merge.htm