asset warranty plus warranty term update

This commit is contained in:
Rene Kaßeböhmer
2025-05-19 15:12:23 +02:00
parent d5742d7d30
commit b675a38baf
31 changed files with 77 additions and 37 deletions

View File

@ -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;;;"
1 Type ActiveFrom ActiveTo ParentRecordId Location.PKey__c
2 Installer (installation) 2017-12-01 001w000001kFZwUAAW Plantsoen de Pas 12, 6601 BK WIJCHEN, NL;;;
3 Owner 2017-12-03 0011r00001kXYKXAA4 Plantsoen de Pas 12, 6601 BK WIJCHEN, NL;;;
4 Installer (installation) 2017-12-01 001w000001kFZwUAAW Munnikhofsestraat 5, 6691 HG GENDT, NL;;;
5 Owner 2017-12-03 0011r00001kXYKcAAO Munnikhofsestraat 5, 6691 HG GENDT, NL;;;
6 Installer (installation) 2017-12-03 0012000000eCRx4AAG Newtonweg 20, 6101 WX ECHT, NL;;;
7 Owner 2017-12-03 0011r00001kXYNMAA4 Newtonweg 20, 6101 WX ECHT, NL;;;

View File

@ -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.')

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,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"
}
]
}
}
]
}
]
}

View File

@ -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
}
]
}

View File

@ -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
}
]
}