How-to conect Magento to another Salesforce org
Short plan:
- 1 1. Disable Powersync synchronization
- 2 2. Cleanup the MagentoId filed on the Salesforce side
- 3 3. Clean “Magento & Salesforce IDs“ table
- 4 4. Connect Magento to a new Salesforce org
- 5 5. Review and Re-save all module config pages
- 6 6. Define new Pricebooks on the Website pages
- 7 7. Re-sync all Magento data
1. Disable Powersync synchronization
First of all, you need to disable Powersync integration
Go to Magento admin panel - Salesforce - General Configuration
Set “Integration Mode“ option to “Disabled“
Save Config
2. Cleanup the MagentoId filed on the Salesforce side
When we sync Magento entities we match them to Salesforce records by the few fields.
One of these “matching“ fields is “Magento Id“, field code is tnw_mage_basic__Magento_ID__c.
When you switch from one Salesforce org - your entity_id field values could be shifted or new record ids could have the same value already used in another Salesforce org.
For example, you had product1 with sku1 and entity_id=1 in the Salesforce org1, but in Salesforce org2 you have product2 with sku2 and entity_id=1. As a result when you start the sync in Magento2 - product1 data will override product2 in your new Salesforce because they have matched Magento Id.
To avoid this problem you need to correct the “Magento Id” fields in your Salesforce org. The following Salesforce entities may have this field (related to the package version you use):
Campaign
Contact
Lead
Opportunity
OpportunityLineItem
Order
OrderItem
Product2
Quote
QuoteLineItem
1) Contact and Lead:
These records could be matched by the Email field
Clean the tnw_mage_basic__Magento_ID__c field: push empty value. Use the dataloader for that. Records will be matched by the Email
2) Account:
These records could be matched by the Name field
3) Product2
These records could be matched by the ProductCode field.
Clean the tnw_mage_basic__Magento_ID__c field: push empty value. Use the dataloader for that. Records will be matched by the ProductCode
4) Campaign - Magento2 module doesn’t support this entity sync.
Clean the tnw_mage_basic__Magento_ID__c field: push empty value. Use the dataloader for that. To avoid future collisions.
5) Order, Opportunity and Quote:
Clean the tnw_mage_basic__Magento_ID__c field: push empty value. Use the dataloader for that.
6) OrderItem, OpportunityLineItem and QuoteLineItem:
Clean the tnw_mage_basic__Magento_ID__c field: push empty value. Use the dataloader for that.
3. Clean “Magento & Salesforce IDs“ table
Go to Magento admin panel - Salesforce - Salesforce Id Mappings
Select all records in “TNW Salesforce / Magento & Salesforce IDs“ table
Click on Action menu - Delete
4. Connect Magento to a new Salesforce org
Now you are able to connect new Salesforce org to your Magento instance
Go to Magento admin panel - Salesforce - General Configuration
Set “Integration Mode“ option to “Magento to Salesforce (only)/Bi-directional“
Provide Username, Password, Token, WSDL Path
Click the “Test Connection & Apply changes“ button
For more detailed information read the Paid Package article
5. Review and Re-save all module config pages
Open all module config pages one by one and Re-save the configuration. List of configuration pages:
B2B and Customers
Products
Orders
Shipments
Invoices
Negotiable Quotes
Quick Order
Returns
Information about product configuration options you can find in Product Documentation article
6. Define new Pricebooks on the Website pages
Do not forget to change old Pricebooks on the Website page to Pricebooks from the new Salesforce org
Go to Magento admin panel - Stores - All Stores
Click On Website to edit it
Select correct Privebook from Default Pricebook drop-down list
Click the Save Web Site button
7. Re-sync all Magento data
Open Magento pages you need to synchronize(Customers, Products, Orders, Shipments, Invoices, Quotes, Returns)
Select all records in the table
Click on the Action menu - Sync with Salesforce