The process contains syncing golden individual data with SFDC.
Mule process:
Input data:
[ "IndividualId1", "IndividualId2" ]
Process :
EXPIRIENCE API:
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:
SELECT Id, RecordMarket__c, Inactive__c FROM Contact WHERE Is_Primary_Contact__c=true AND IsDeleted=false AND AccountId='" + vars.'account_id' + "'
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)
fullname: profileFirstName ++ profileMiddleName ++ profileLastName Coutry_TXT mapping: { "THA": "Thailand", "VNM": "Vietnam", "SGP": "Singapore", "MYS": "Malaysia", "BRN": "Brunei", "IDN": "Indonesia", "PHL": "Philippines", "USA": "USA" }
Mapping:
First_Name__c: profileFirstName Last_Name__c: profileLastName Middle_Name__c: profileMiddleName Name: fullName Id: def_data.account_id RecordTypeId: profileBrandOrgCode Address_Line_1__c: profileAddressLine1 Address_Line_2__c: profileAddressLine2 Address_Remarks__c: profileJsonExternalData.AddressRemarks Mobile_Phone__c: profileMobilePhone Home_phone__c: profileHomePhone Home_phone__c: profileHomePhone splitBy("x"))[0] Home_Phone_Extension__c: (profileHomePhone splitBy("x"))[1])) Other_Phone_1__c: profileWorkPhone Other_Phone_1__c: profileOtherPhone Account_Email__c: profileEmailAddress Member_Country__c: COUNTRY_TXT[vars.profileCountryCode]
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:
District__c: profileAddressLine3 -> with additonal logic of splitting data Region__c: profileAddressLine3 -> with additional logic of splitting data Name: profileCity State_Province__c: profileState Zip_Code__c: profilePostalCode Country__c: COUNTRY_TXT[vars.profileCountryCode] //This element should not work there is no COUNTRY_TXT in dataweave
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
Python process:
Add Comment