/golden
The process contains syncing golden individual data with SFDC.
Mule process:
Input data:
[
"IndividualId1",
"IndividualId2"
]
Process:
Required header “validator“ with value: rbesb
Request Epsilon for a token (It is needed to be moved to middleware Mulesoft)
For each individual id
Get from CDP - Golden Individual - saved under “profile”
Get from CDP - Contacts - export from its contact and save under “emails”, “phones”
Map enrollments - if there are any children, gather all enrollments and save them under “enrollChildren”
Sync process:
Check Contact
Query Object: Account with several conditions (SFSC)
var boc = if (vars.profile.BrandOrgCode == 'MJNTHA') "TH_Household" else if (vars.profile.BrandOrgCode == 'MJNIDN') "ID_Household" else if (vars.profile.BrandOrgCode == 'MJNMYS') "MY_Household" else if (vars.profile.BrandOrgCode == 'MJNSGP') "MY_Household" else if (vars.profile.BrandOrgCode == 'MJNBRN') "MY_Household" else if (vars.profile.BrandOrgCode == 'MJNVNM') "VN_Household" else null
SELECT Id, OwnerId, Inactive__c FROM Account WHERE IsDeleted=false AND RecordMarket__c= ++ boc ++ AND ++ QUERIES EMAILS OR PHONES (Depending if values exists)
It is saved later in a variable: “contactQueryResponse”
If contacts do not exist = logger. If contacts exist then:
Filter contacts if Inactive__c == “false”. If false then = logger, if true then:
Load data from vars to payload
Query data for parents (SFSC):
Data is saved into a variable: “contactQueryResponse”
If parents exist: for each parent there are transformations made. If parents do not exist it just logs proper information.
Mapping Household
Prepare new_account variable: (Variables inside DW)
Mapping:
If values are not blank then it is appended to the payload. In another case, the whole key is deleted from the request. All data are in vars. (It can cause memory issues later if data is larger).
Prepare cityData variable:
If Profile ID SF is equal to profile ID from CDP
For each: JsonExternalData
If payload profile id equals correctly and mom status is not empty and mom status is equal to first time then
Mom_status equals:
"1st Time"
In other case logger
if Profile ID SF is NOT equal to profile ID from CDP
If ProfileSubscriptions and JsonExternalData are not empty for each profile subscription do:
If optStatus is true and channelCode contains channelCode(??? payload.OptStatuss == true and !(payload.ChannelCode contains payload.ChannelCode) ???) prepare parse_subs which is currently empty object in other case it also empty object
Prepare subscriptions in payload
Adding to new_account object (and saving to payload)
The query is being prepared for the city - Long logic - Object City__c
Query City (SF)
Does city query have at least 3 query conditions? if true then
Query City
if value is not empty it is appending additional data to vars with account
In other cases it logs information
If false then
Creates/Updates a household data into SF (Object Account
CDP - SFDC Sync - Upsert contact If parentIdQueryResponse is empty this one is skipped in other cases:
Create def_data variable:
If a Child should be created - Sync children - (MAPPING ONLY)
Mapping - Most data is from payload. Need to be validated when running
In this process, there are multiple for each using extra_data and even extra_data.Children (Why not payload.Children)
Big choice which contains
!isEmpty(vars.new_children) and vars.create_child == true - only logger (Missing implementation?)
isEmpty(vars.new_children) and vars.create_child == true - Only logger - no children to upsert
!isBlank(vars.def_data.contact_id) - Contains logger that should be updated but creates Contact Parent
default - Creates Contact Parent It is double the same logic
Contains Logger TODO - What is missing Syncing children? enrollments?
End of the process