first draft update account

This commit is contained in:
Rene Kaßeböhmer
2025-04-11 14:49:18 +02:00
parent 6bd77c8b3e
commit 9174dafb43
10 changed files with 83 additions and 18 deletions

View File

@ -0,0 +1,2 @@
@echo off
python .\extract_via_simple_salesforce.py --context qa2

View File

@ -1 +0,0 @@
python .\extract_via_simple_salesforce.py --context prod

View File

@ -2,10 +2,10 @@
[
{
"sobject": "SCInstalledBaseLocation__c",
"query": "SELECT Id, City__c, Country__c, GeoY__c, GeoX__c, PostalCode__c, Street__c, Extension__c, HouseNo__c, FlatNo__c, Floor__c FROM SCInstalledBaseLocation__c WHERE Country__c = 'NL'"
"query": "SELECT Id, City__c, Country__c, GeoY__c, GeoX__c, PostalCode__c, Street__c, Extension__c, HouseNo__c, FlatNo__c, Floor__c FROM SCInstalledBaseLocation__c WHERE Country__c = 'NL' limit 1"
},{
"sobject": "SCInstalledBase__c",
"query": "SELECT Id, Name, CommissioningDate__c,InstallationDate__c,ProductEnergy__c, ProductUnitClass__c,ArticleNo__c,SerialNo__c, SerialNoException__c, ProductUnitType__c, InstalledBaseLocation__c FROM SCInstalledBase__c WHERE Country__c = 'NL'"
"query": "SELECT Id, Name, CommissioningDate__c,InstallationDate__c,ProductEnergy__c, ProductUnitClass__c,ArticleNo__c,SerialNo__c, SerialNoException__c, ProductUnitType__c, InstalledBaseLocation__c FROM SCInstalledBase__c WHERE Country__c = 'NL' limit 1"
},{
"sobject": "Asset",
"query": "SELECT Id, Serialnumber FROM Asset WHERE Location.ParentLocation.Name LIKE '%NL'"

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,72 @@
{
"allOrNone": true,
"objects": [
{
"query": "SELECT Id, SobjectType from recordtype where SobjectType = 'Account' and Name = 'Person'",
"operation": "Readonly",
"master": false
},{
"query": "SELECT Id, BillingHouseNo__c,BillingStreet__c, BillingCountry__c,BillingPostalCode__c FROM Account WHERE isPersonAccount = true and BillingCountry__c = 'NL' AND RecordTypeId = '01220000000E59RAAS'",
"operation": "Update",
"master": true,
"beforeUpdateAddons": [
{
"module": "core:RecordsTransform",
"description": "Updates RecordTypeId with source .Id based on Pkey__c",
"args": {
"fields": [
{
"alias": "sourceRecordTypeId",
"sourceObject": "recordtype",
"sourceField": "Id",
"lookupExpression": "source.Name == 'Person'"
},{
"alias": "sourceAddressCountryForFSL",
"sourceObject": "Account",
"sourceField": "BillingCountry__c",
"lookupExpression": "source.Id == target.Id"
},{
"alias": "sourceAddressStreetForFSL",
"sourceObject": "Account",
"sourceField": "BillingStreet__c",
"lookupExpression": "source.Id == target.Id"
},{
"alias": "sourceAddressHouseNoForFSL",
"sourceObject": "Account",
"sourceField": "BillingHouseNo__c",
"lookupExpression": "source.Id == target.Id"
},{
"alias": "sourceAddressPostalCodeForFSL",
"sourceObject": "Account",
"sourceField": "BillingPostalCode__c",
"lookupExpression": "source.Id == target.Id"
}
],
"transformations": [
{
"targetObject": "Account",
"targetField": "RecordTypeId",
"formula": "formula.sourceRecordTypeId"
},{
"targetObject": "Account",
"targetField": "BillingCountryCode",
"formula": "formula.sourceAddressCountryForFSL"
},{
"targetObject": "Account",
"targetField": "BillingStreet",
"formula": "formula.sourceAddressStreetForFSL + ' ' + formula.sourceAddressHouseNoForFSL"
},{
"targetObject": "Account",
"targetField": "BillingPostalCode",
"expressions": [
"formula.exists = formula.sourceAddressPostalCodeForFSL"
],
"formula": "formula.exists ? formula.sourceAddressPostalCodeForFSL : null"
}
]
}
}
]
}
]
}

21
run.bat
View File

@ -1,26 +1,17 @@
@echo off
setlocal enabledelayedexpansion
:: Change directory to where prepared_steps is located
cd ..\..\prepared_steps
cd .\prepared_steps
:: Loop through all folders in prepared_steps
for /d %%f in (*.*) do (
set "current_dir=%%f"
:: Check if command.txt exists in the current folder
if exist "%current_dir%\command.txt" (
echo Running command from %current_dir%
if exist "%%f\command.bat" (
echo Running command from %%f
:: Read the command from command.txt and execute it
for /f %%c in ('type "%current_dir%\command.txt"') do (
start "" "%%c"
for /f "usebackq delims=" %%c in ('type "%%f\command.bat"') do (
call %%c
)
:: Pause after each command to see results
pause
) else (
echo No command.txt found in %current_dir%
echo No command.bat found in %%f
)
)