From b675a38bafe06a78f601f2e52565023d0c42d847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=20Ka=C3=9Feb=C3=B6hmer?= Date: Mon, 19 May 2025 15:12:23 +0200 Subject: [PATCH] asset warranty plus warranty term update --- .../command.txt | 0 .../export.json | 0 .../FillLocationId.py | 0 .../command.txt | 0 .../AssociatedLocation_beforetransform.csv | 7 ---- .../AssociatedLocation_test.csv_test | 0 .../ValueMapping.csv | 0 .../command.txt | 0 .../export.json | 0 .../command.txt | 0 .../export.json | 0 .../ValueMapping.csv | 0 .../command.txt | 0 .../export.json | 0 .../FillServiceContractFields.py | 0 .../command.txt | 0 .../ValueMapping.csv | 0 .../command.txt | 0 .../export.json | 0 .../run_insert.py | 0 .../UpdateContractsSelfRerefence.py | 0 .../command.txt | 0 .../command.txt | 0 .../export.json | 0 .../2_transform_via_script/TransformScript.py | 18 +++++----- .../8_update_warrantyterms/command.txt | 1 + .../8_update_warrantyterms/export.json | 32 +++++++++++++++++ prepared_steps/8_upsert_assets/export.json | 21 ----------- .../ValueMapping.csv | 0 .../command.txt | 0 prepared_steps/9_upsert_assets/export.json | 35 +++++++++++++++++++ 31 files changed, 77 insertions(+), 37 deletions(-) rename prepared_steps/{11_upsert_associated_location => 10_update_personaccounts}/command.txt (100%) rename prepared_steps/{9_update_personaccounts => 10_update_personaccounts}/export.json (100%) rename prepared_steps/{10_fill_location_id_for_associated_location => 11_fill_location_id_for_associated_location}/FillLocationId.py (100%) rename prepared_steps/{10_fill_location_id_for_associated_location => 11_fill_location_id_for_associated_location}/command.txt (100%) delete mode 100644 prepared_steps/11_upsert_associated_location/AssociatedLocation_beforetransform.csv rename prepared_steps/{11_upsert_associated_location => 12_upsert_associated_location}/AssociatedLocation_test.csv_test (100%) rename prepared_steps/{11_upsert_associated_location => 12_upsert_associated_location}/ValueMapping.csv (100%) rename prepared_steps/{17_update_servicecontract => 12_upsert_associated_location}/command.txt (100%) rename prepared_steps/{11_upsert_associated_location => 12_upsert_associated_location}/export.json (100%) rename prepared_steps/{12_insert_pricebook2_and_pricebookentries => 13_insert_pricebook2_and_pricebookentries}/command.txt (100%) rename prepared_steps/{12_insert_pricebook2_and_pricebookentries => 13_insert_pricebook2_and_pricebookentries}/export.json (100%) rename prepared_steps/{13_insert_servicecontracttemplates_dummies => 14_insert_servicecontracttemplates_dummies}/ValueMapping.csv (100%) rename prepared_steps/{13_insert_servicecontracttemplates_dummies => 14_insert_servicecontracttemplates_dummies}/command.txt (100%) rename prepared_steps/{13_insert_servicecontracttemplates_dummies => 14_insert_servicecontracttemplates_dummies}/export.json (100%) rename prepared_steps/{14_fill_pricebook2id_in_servicecontract => 15_fill_pricebook2id_in_servicecontract}/FillServiceContractFields.py (100%) rename prepared_steps/{14_fill_pricebook2id_in_servicecontract => 15_fill_pricebook2id_in_servicecontract}/command.txt (100%) rename prepared_steps/{15_insert_servicecontract => 16_insert_servicecontract}/ValueMapping.csv (100%) rename prepared_steps/{15_insert_servicecontract => 16_insert_servicecontract}/command.txt (100%) rename prepared_steps/{15_insert_servicecontract => 16_insert_servicecontract}/export.json (100%) rename prepared_steps/{15_insert_servicecontract => 16_insert_servicecontract}/run_insert.py (100%) rename prepared_steps/{16_build_servicecontract_self_reference => 17_build_servicecontract_self_reference}/UpdateContractsSelfRerefence.py (100%) rename prepared_steps/{16_build_servicecontract_self_reference => 17_build_servicecontract_self_reference}/command.txt (100%) rename prepared_steps/{9_update_personaccounts => 18_update_servicecontract}/command.txt (100%) rename prepared_steps/{17_update_servicecontract => 18_update_servicecontract}/export.json (100%) create mode 100644 prepared_steps/8_update_warrantyterms/command.txt create mode 100644 prepared_steps/8_update_warrantyterms/export.json delete mode 100644 prepared_steps/8_upsert_assets/export.json rename prepared_steps/{8_upsert_assets => 9_upsert_assets}/ValueMapping.csv (100%) rename prepared_steps/{8_upsert_assets => 9_upsert_assets}/command.txt (100%) create mode 100644 prepared_steps/9_upsert_assets/export.json diff --git a/prepared_steps/11_upsert_associated_location/command.txt b/prepared_steps/10_update_personaccounts/command.txt similarity index 100% rename from prepared_steps/11_upsert_associated_location/command.txt rename to prepared_steps/10_update_personaccounts/command.txt diff --git a/prepared_steps/9_update_personaccounts/export.json b/prepared_steps/10_update_personaccounts/export.json similarity index 100% rename from prepared_steps/9_update_personaccounts/export.json rename to prepared_steps/10_update_personaccounts/export.json diff --git a/prepared_steps/10_fill_location_id_for_associated_location/FillLocationId.py b/prepared_steps/11_fill_location_id_for_associated_location/FillLocationId.py similarity index 100% rename from prepared_steps/10_fill_location_id_for_associated_location/FillLocationId.py rename to prepared_steps/11_fill_location_id_for_associated_location/FillLocationId.py diff --git a/prepared_steps/10_fill_location_id_for_associated_location/command.txt b/prepared_steps/11_fill_location_id_for_associated_location/command.txt similarity index 100% rename from prepared_steps/10_fill_location_id_for_associated_location/command.txt rename to prepared_steps/11_fill_location_id_for_associated_location/command.txt diff --git a/prepared_steps/11_upsert_associated_location/AssociatedLocation_beforetransform.csv b/prepared_steps/11_upsert_associated_location/AssociatedLocation_beforetransform.csv deleted file mode 100644 index 7956e7d..0000000 --- a/prepared_steps/11_upsert_associated_location/AssociatedLocation_beforetransform.csv +++ /dev/null @@ -1,7 +0,0 @@ -Type,ActiveFrom,ActiveTo,ParentRecordId,Location.PKey__c -Installer (installation),2017-12-01,,001w000001kFZwUAAW,"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL;;;" -Owner,2017-12-03,,0011r00001kXYKXAA4,"Plantsoen de Pas 12, 6601 BK WIJCHEN, NL;;;" -Installer (installation),2017-12-01,,001w000001kFZwUAAW,"Munnikhofsestraat 5, 6691 HG GENDT, NL;;;" -Owner,2017-12-03,,0011r00001kXYKcAAO,"Munnikhofsestraat 5, 6691 HG GENDT, NL;;;" -Installer (installation),2017-12-03,,0012000000eCRx4AAG,"Newtonweg 20, 6101 WX ECHT, NL;;;" -Owner,2017-12-03,,0011r00001kXYNMAA4,"Newtonweg 20, 6101 WX ECHT, NL;;;" diff --git a/prepared_steps/11_upsert_associated_location/AssociatedLocation_test.csv_test b/prepared_steps/12_upsert_associated_location/AssociatedLocation_test.csv_test similarity index 100% rename from prepared_steps/11_upsert_associated_location/AssociatedLocation_test.csv_test rename to prepared_steps/12_upsert_associated_location/AssociatedLocation_test.csv_test diff --git a/prepared_steps/11_upsert_associated_location/ValueMapping.csv b/prepared_steps/12_upsert_associated_location/ValueMapping.csv similarity index 100% rename from prepared_steps/11_upsert_associated_location/ValueMapping.csv rename to prepared_steps/12_upsert_associated_location/ValueMapping.csv diff --git a/prepared_steps/17_update_servicecontract/command.txt b/prepared_steps/12_upsert_associated_location/command.txt similarity index 100% rename from prepared_steps/17_update_servicecontract/command.txt rename to prepared_steps/12_upsert_associated_location/command.txt diff --git a/prepared_steps/11_upsert_associated_location/export.json b/prepared_steps/12_upsert_associated_location/export.json similarity index 100% rename from prepared_steps/11_upsert_associated_location/export.json rename to prepared_steps/12_upsert_associated_location/export.json diff --git a/prepared_steps/12_insert_pricebook2_and_pricebookentries/command.txt b/prepared_steps/13_insert_pricebook2_and_pricebookentries/command.txt similarity index 100% rename from prepared_steps/12_insert_pricebook2_and_pricebookentries/command.txt rename to prepared_steps/13_insert_pricebook2_and_pricebookentries/command.txt diff --git a/prepared_steps/12_insert_pricebook2_and_pricebookentries/export.json b/prepared_steps/13_insert_pricebook2_and_pricebookentries/export.json similarity index 100% rename from prepared_steps/12_insert_pricebook2_and_pricebookentries/export.json rename to prepared_steps/13_insert_pricebook2_and_pricebookentries/export.json diff --git a/prepared_steps/13_insert_servicecontracttemplates_dummies/ValueMapping.csv b/prepared_steps/14_insert_servicecontracttemplates_dummies/ValueMapping.csv similarity index 100% rename from prepared_steps/13_insert_servicecontracttemplates_dummies/ValueMapping.csv rename to prepared_steps/14_insert_servicecontracttemplates_dummies/ValueMapping.csv diff --git a/prepared_steps/13_insert_servicecontracttemplates_dummies/command.txt b/prepared_steps/14_insert_servicecontracttemplates_dummies/command.txt similarity index 100% rename from prepared_steps/13_insert_servicecontracttemplates_dummies/command.txt rename to prepared_steps/14_insert_servicecontracttemplates_dummies/command.txt diff --git a/prepared_steps/13_insert_servicecontracttemplates_dummies/export.json b/prepared_steps/14_insert_servicecontracttemplates_dummies/export.json similarity index 100% rename from prepared_steps/13_insert_servicecontracttemplates_dummies/export.json rename to prepared_steps/14_insert_servicecontracttemplates_dummies/export.json diff --git a/prepared_steps/14_fill_pricebook2id_in_servicecontract/FillServiceContractFields.py b/prepared_steps/15_fill_pricebook2id_in_servicecontract/FillServiceContractFields.py similarity index 100% rename from prepared_steps/14_fill_pricebook2id_in_servicecontract/FillServiceContractFields.py rename to prepared_steps/15_fill_pricebook2id_in_servicecontract/FillServiceContractFields.py diff --git a/prepared_steps/14_fill_pricebook2id_in_servicecontract/command.txt b/prepared_steps/15_fill_pricebook2id_in_servicecontract/command.txt similarity index 100% rename from prepared_steps/14_fill_pricebook2id_in_servicecontract/command.txt rename to prepared_steps/15_fill_pricebook2id_in_servicecontract/command.txt diff --git a/prepared_steps/15_insert_servicecontract/ValueMapping.csv b/prepared_steps/16_insert_servicecontract/ValueMapping.csv similarity index 100% rename from prepared_steps/15_insert_servicecontract/ValueMapping.csv rename to prepared_steps/16_insert_servicecontract/ValueMapping.csv diff --git a/prepared_steps/15_insert_servicecontract/command.txt b/prepared_steps/16_insert_servicecontract/command.txt similarity index 100% rename from prepared_steps/15_insert_servicecontract/command.txt rename to prepared_steps/16_insert_servicecontract/command.txt diff --git a/prepared_steps/15_insert_servicecontract/export.json b/prepared_steps/16_insert_servicecontract/export.json similarity index 100% rename from prepared_steps/15_insert_servicecontract/export.json rename to prepared_steps/16_insert_servicecontract/export.json diff --git a/prepared_steps/15_insert_servicecontract/run_insert.py b/prepared_steps/16_insert_servicecontract/run_insert.py similarity index 100% rename from prepared_steps/15_insert_servicecontract/run_insert.py rename to prepared_steps/16_insert_servicecontract/run_insert.py diff --git a/prepared_steps/16_build_servicecontract_self_reference/UpdateContractsSelfRerefence.py b/prepared_steps/17_build_servicecontract_self_reference/UpdateContractsSelfRerefence.py similarity index 100% rename from prepared_steps/16_build_servicecontract_self_reference/UpdateContractsSelfRerefence.py rename to prepared_steps/17_build_servicecontract_self_reference/UpdateContractsSelfRerefence.py diff --git a/prepared_steps/16_build_servicecontract_self_reference/command.txt b/prepared_steps/17_build_servicecontract_self_reference/command.txt similarity index 100% rename from prepared_steps/16_build_servicecontract_self_reference/command.txt rename to prepared_steps/17_build_servicecontract_self_reference/command.txt diff --git a/prepared_steps/9_update_personaccounts/command.txt b/prepared_steps/18_update_servicecontract/command.txt similarity index 100% rename from prepared_steps/9_update_personaccounts/command.txt rename to prepared_steps/18_update_servicecontract/command.txt diff --git a/prepared_steps/17_update_servicecontract/export.json b/prepared_steps/18_update_servicecontract/export.json similarity index 100% rename from prepared_steps/17_update_servicecontract/export.json rename to prepared_steps/18_update_servicecontract/export.json diff --git a/prepared_steps/2_transform_via_script/TransformScript.py b/prepared_steps/2_transform_via_script/TransformScript.py index 95017f3..7f1c995 100644 --- a/prepared_steps/2_transform_via_script/TransformScript.py +++ b/prepared_steps/2_transform_via_script/TransformScript.py @@ -287,11 +287,11 @@ merged_df_ib = merged_df_ib.drop('Floor__c', axis=1) merged_df_ib = merged_df_ib.drop('InstalledBaseLocation__c', axis=1) #merged_df_ib = merged_df_ib.drop('InstalledBaseLocation__r.Id', axis=1) merged_df_ib = merged_df_ib.drop('Id_y', axis=1) -merged_df_ib = merged_df_ib.drop('Id_x', axis=1) +#merged_df_ib = merged_df_ib.drop('Id_x', axis=1) merged_df_ib = merged_df_ib.drop('ProductUnitClass__c', axis=1) merged_df_ib = merged_df_ib.drop('ProductUnitType__c', axis=1) -merged_df_ib.columns = ['Name', 'FSL_1st_Ignition_Date__c', 'InstallDate', 'Kind_of_Energy__c', 'Product2.Product_Code__c', 'SerialNumber', 'Serialnumber_Exception__c', 'Location.PKey__c'] +merged_df_ib.columns = ['PKey__c', 'Name', 'FSL_1st_Ignition_Date__c', 'InstallDate', 'Kind_of_Energy__c', 'Product2.Product_Code__c', 'SerialNumber', 'Serialnumber_Exception__c', 'Location.PKey__c'] #merged_df_ib = merged_df_ib.drop('Main_Product_Group__c', axis=1) # assign Main_Product_Group__c based on product2 records merged_df_ib = pd.merge(merged_df_ib, @@ -547,14 +547,14 @@ df_servicecontract['Term'] = df_servicecontract['Term'].fillna(0).astype(int) address_df.to_csv('../4_upsert_address_and_parent_location/Address.csv', index=False) parent_df.to_csv('../4_upsert_address_and_parent_location/Location.csv', index=False) child_df.to_csv('../6_upsert_child_location/Location.csv', index=False) -merged_df_ib.to_csv('../8_upsert_assets/Asset.csv', index=False) -df_ibr.to_csv('../11_upsert_associated_location/AssociatedLocation_beforetransform.csv', index=False) -df_pricelist.to_csv('../12_insert_pricebook2_and_pricebookentries/Pricebook2.csv', index=False) -df_pricelistitem.to_csv('../12_insert_pricebook2_and_pricebookentries/PricebookEntry.csv', index=False) +merged_df_ib.to_csv('../9_upsert_assets/Asset.csv', index=False) +df_ibr.to_csv('../12_upsert_associated_location/AssociatedLocation_beforetransform.csv', index=False) +df_pricelist.to_csv('../13_insert_pricebook2_and_pricebookentries/Pricebook2.csv', index=False) +df_pricelistitem.to_csv('../13_insert_pricebook2_and_pricebookentries/PricebookEntry.csv', index=False) merged_df_location_iot.to_csv('../3_update_address_and_location_data_for_migration/Location.csv', index=False) -df_servicecontracttemplates.to_csv('../13_insert_servicecontracttemplates_dummies/ServiceContract.csv', index=False) -df_servicecontract.to_csv('../15_insert_servicecontract/ServiceContract_beforetransform.csv', index=False) -df_assetwarranty_save.to_csv('../8_upsert_assets/AssetWarranty.csv', index=False) +df_servicecontracttemplates.to_csv('../14_insert_servicecontracttemplates_dummies/ServiceContract.csv', index=False) +df_servicecontract.to_csv('../16_insert_servicecontract/ServiceContract_beforetransform.csv', index=False) +df_assetwarranty_save.to_csv('../9_upsert_assets/AssetWarranty.csv', index=False) ## end mapping print('Data has been successfully transformed and saved to CSV files.') \ No newline at end of file diff --git a/prepared_steps/8_update_warrantyterms/command.txt b/prepared_steps/8_update_warrantyterms/command.txt new file mode 100644 index 0000000..0389686 --- /dev/null +++ b/prepared_steps/8_update_warrantyterms/command.txt @@ -0,0 +1 @@ +sf sfdmu run --sourceusername rene.kasseboehmer@vaillant.de.devrene --targetusername rene.kasseboehmer@vaillant.de.devrene \ No newline at end of file diff --git a/prepared_steps/8_update_warrantyterms/export.json b/prepared_steps/8_update_warrantyterms/export.json new file mode 100644 index 0000000..c8c86d5 --- /dev/null +++ b/prepared_steps/8_update_warrantyterms/export.json @@ -0,0 +1,32 @@ +{ + "allOrNone": true, + "objects": [ + { + "query": "SELECT Id FROM WarrantyTerm WHERE PKey__c = null", + "operation": "Update", + "beforeUpdateAddons": [ + { + "module": "core:RecordsTransform", + "description": "Copies Id of record into Pkey__c field", + "args": { + "fields": [ + { + "alias": "sourceIdFromWarrantyTerm", + "sourceObject": "WarrantyTerm", + "sourceField": "Id", + "lookupSource": "source" + } + ], + "transformations": [ + { + "targetObject": "WarrantyTerm", + "targetField": "PKey__c", + "formula": "formula.sourceIdFromWarrantyTerm" + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/prepared_steps/8_upsert_assets/export.json b/prepared_steps/8_upsert_assets/export.json deleted file mode 100644 index 712cc48..0000000 --- a/prepared_steps/8_upsert_assets/export.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "allOrNone": true, - "excludeIdsFromCSVFiles": true, - "objects": [ - { - "query": "SELECT PKey__c FROM Location WHERE PKey__c != null AND ParentLocation.VisitorAddress.CountryCode = 'NL'", - "operation": "Readonly", - "externalId": "PKey__c" - },{ - "query": "SELECT Product_Code__c FROM Product2 WHERE Product_Code__c != null", - "operation": "Readonly", - "externalId": "Product_Code__c", - "master": false - },{ - "query": "SELECT Product2Id,InstallDate,Name,Kind_of_Energy__c,Main_Product_Group__c,SerialNumber,Serialnumber_Exception__c,LocationId FROM Asset", - "operation": "Insert", - "master": true, - "useValuesMapping": true - } - ] -} \ No newline at end of file diff --git a/prepared_steps/8_upsert_assets/ValueMapping.csv b/prepared_steps/9_upsert_assets/ValueMapping.csv similarity index 100% rename from prepared_steps/8_upsert_assets/ValueMapping.csv rename to prepared_steps/9_upsert_assets/ValueMapping.csv diff --git a/prepared_steps/8_upsert_assets/command.txt b/prepared_steps/9_upsert_assets/command.txt similarity index 100% rename from prepared_steps/8_upsert_assets/command.txt rename to prepared_steps/9_upsert_assets/command.txt diff --git a/prepared_steps/9_upsert_assets/export.json b/prepared_steps/9_upsert_assets/export.json new file mode 100644 index 0000000..37c7417 --- /dev/null +++ b/prepared_steps/9_upsert_assets/export.json @@ -0,0 +1,35 @@ +{ + "allOrNone": true, + "excludeIdsFromCSVFiles": true, + "objects": [ + { + "query": "SELECT PKey__c FROM Location WHERE PKey__c != null AND ParentLocation.VisitorAddress.CountryCode = 'NL'", + "operation": "Readonly", + "externalId": "PKey__c" + },{ + "query": "SELECT Product_Code__c FROM Product2 WHERE Product_Code__c != null", + "operation": "Readonly", + "externalId": "Product_Code__c", + "master": false + },{ + "query": "SELECT PKey__c FROM WarrantyTerm", + "operation": "Readonly", + "externalId": "PKey__c", + "queryAllTarget": true, + "master": false + },{ + "query": "SELECT PKey__c,Product2Id,InstallDate,Name,Kind_of_Energy__c,Main_Product_Group__c,SerialNumber,Serialnumber_Exception__c,LocationId FROM Asset", + "operation": "Insert", + "externalId": "PKey__c", + "master": true, + "useValuesMapping": true, + "useSourceCSVFile": true + },{ + "query": "SELECT AssetId,StartDate,EndDate,WarrantyTermId FROM AssetWarranty", + "operation": "Insert", + "master": true, + "useValuesMapping": true, + "useSourceCSVFile": true + } + ] +} \ No newline at end of file