address, paren location & child location logic finished

This commit is contained in:
Rene Kaßeböhmer
2025-03-31 17:29:55 +02:00
parent a3d7491d11
commit b1b9d3db8a
11 changed files with 91 additions and 8 deletions

View File

@ -1,2 +1,2 @@
Parent.Name,City,Country,PostalCode,Street,Latitude,Longitude,CountryCode
"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL",WIJCHEN,Netherlands,6601 BK,Plantsoen de Pas 12,51.81388993,5.72578937,NL
Parent.Name,City,Country,PostalCode,Street,Latitude,Longitude,CountryCode,PKey__c
"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL",WIJCHEN,Netherlands,6601 BK,Plantsoen de Pas 12,51.81388993,5.72578937,NL,"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL"
1 Parent.Name City Country PostalCode Street Latitude Longitude CountryCode PKey__c
2 Plantsoen de Pas 12, 6601 BK WIJCHEN, NL WIJCHEN Netherlands 6601 BK Plantsoen de Pas 12 51.81388993 5.72578937 NL Plantsoen de Pas 12, 6601 BK WIJCHEN, NL

View File

@ -0,0 +1 @@
sf sfdmu run --sourceusername csvfile --targetusername rene.kasseboehmer@vaillant.de.devrene

View File

@ -4,11 +4,11 @@
"excludeIdsFromCSVFiles": true,
"objects": [
{
"query": "SELECT Name,DuplicateCheck__c,IsInventoryLocation,IsMobile,LocationType,VisitorAddressId FROM Location",
"query": "SELECT Name,DuplicateCheck__c,IsInventoryLocation,IsMobile,LocationType FROM Location",
"operation": "Insert",
"externalId": "Name"
},{
"query": "SELECT City, Country, PostalCode, Street, Latitude, Longitude, CountryCode, ParentId$Location FROM Address",
"query": "SELECT City, Country, PostalCode, Street, Latitude, Longitude, CountryCode, Pkey__c, ParentId$Location FROM Address",
"operation": "Insert"
}
]

View File

@ -0,0 +1 @@
sf sfdmu run --sourceusername rene.kasseboehmer@vaillant.de.devrene --targetusername rene.kasseboehmer@vaillant.de.devrene

View File

@ -0,0 +1,37 @@
{
"allOrNone": true,
"objects": [
{
"query": "SELECT Id, Pkey__c FROM Address WHERE CountryCode = 'NL' AND PKey__c != null",
"operation": "Readonly"
},{
"query": "SELECT Id, Name, VisitorAdressId FROM Location WHERE VisitorAddressId = null",
"operation": "Update",
"beforeUpdateAddons": [
{
"module": "core:RecordsTransform",
"description": "Updates VisitorAddressId with source Address.Id based on Pkey__c",
"args": {
"fields": [
{
"alias": "sourceAddressIdFromPkey",
"sourceObject": "Address",
"sourceField": "Id",
"lookupExpression": "source.PKey__c == target.Name",
"lookupSource": "source"
}
],
"transformations": [
{
"targetObject": "Location",
"targetField": "VisitorAddressId",
"formula": "formula.sourceAddressIdFromPkey"
}
]
}
}
],
"externalId": "Name"
}
]
}

View File

@ -0,0 +1,2 @@
ParentLocation.Name,Extension,Flat,Floor,Name,DuplicateCheck__c,IsInventoryLocation,IsMobile,LocationType,PKey__c
"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL",test,,,--,false,false,false,Site,"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL"
1 ParentLocation.Name Extension Flat Floor Name DuplicateCheck__c IsInventoryLocation IsMobile LocationType PKey__c
2 Plantsoen de Pas 12, 6601 BK WIJCHEN, NL test -- false false false Site Plantsoen de Pas 12, 6601 BK WIJCHEN, NL

View File

@ -0,0 +1 @@
sf sfdmu run --sourceusername csvfile --targetusername rene.kasseboehmer@vaillant.de.devrene

View File

@ -0,0 +1,11 @@
{
"allOrNone": true,
"excludeIdsFromCSVFiles": true,
"objects": [
{
"query": "SELECT Extension,Flat,Floor,Name,DuplicateCheck__c,IsInventoryLocation,IsMobile,LocationType,PKey__c FROM Location",
"operation": "Insert",
"useSourceCSVFile": true
}
]
}

View File

@ -0,0 +1 @@
sf sfdmu run --sourceusername csvfile --targetusername rene.kasseboehmer@vaillant.de.devrene

View File

@ -0,0 +1,33 @@
{
"allOrNone": true,
"objects": [
{
"query": "SELECT Id, Name, Pkey__c, ParentLocationId FROM Location WHERE Pkey__c != null AND PKey__c like '%NL' AND ParentLocationId = null AND VisitorAddressId = null",
"operation": "Update",
"beforeUpdateAddons": [
{
"module": "core:RecordsTransform",
"description": "Updates ParentLocationId with source Address.ParentId based on Pkey__c",
"args": {
"fields": [
{
"alias": "sourceAddressParentIdFromPkey",
"sourceObject": "Address",
"sourceField": "ParentId",
"lookupExpression": "source.PKey__c == target.Pkey__c",
"lookupSource": "source"
}
],
"transformations": [
{
"targetObject": "Location",
"targetField": "ParentLocationId",
"formula": "formula.sourceAddressParentIdFromPkey"
}
]
}
}
]
}
]
}