Overview
Customer Address records from iPaaS.com can be synchronized into Magento using a manual sync method. This mapping supports the synchronization of customer data from iPaaS into Magento via the Customer API.
Mapping Collection Status
Mapping Status: Enabled.
Trigger Events: The sync is triggered manually or when a customer address record is created or updated in iPaaS.
ID Format: When manually syncing, the correct iPaaS CustomerID must be entered (e.g., Customer John Doe with Address ID 138535ZZ_BAR_ZZ211960 must be entered as 138535ZZ_BAR_ZZ211960).
Conflicting Mappings: This mapping applies only to Customer records. Ensure no other mappings target the same Magento entity to prevent data from being overwritten.
System Caveats
iPaaS Caveats
In Magento, a customer must have at least one valid primary billing or shipping address. The following flags control how addresses are uploaded:
IsPrimaryBilling – set to true to upload as the billing address.
IsPrimaryShipping – set to true to upload as the shipping address.
If a customer has no default billing or shipping address, Magento will reject the record.
Magento Caveats
Customer records must exist in Magento.
Dynamic formulas must return valid references for GroupId and CompanyId to avoid rejection.
Setup Requirements
iPaaS Configuration
CustomerID: Unique identifier in iPaaS.
Magento Configuration
CustomerID: Maps to iPaaS Customer ID.
Ensure default billing/shipping address flags are correctly applied.
Authentication & Security
Magento2 API UserName: Used to access iPaaS API for fetching Company and related data.
Magento2 API Key: Used to access iPaaS API for fetching Company and related data.
Integration Flow
Retrieve Data: Get customer address data from iPaaS.
Map Fields: Map customer address data to Magento 2 fields, applying any dynamic formulas.
Apply Overrides: Apply static or computed values as needed during mapping.
Mappings
Magento Customer Address From iPaaS (Standalone)
Description: Region Related Mappings:
M2_CustomerAdd_Regionid → RegionId
M2_CustomerAdd_RegionCode → RegionCode
M2_CustomerAdd_Region → Region
At least one of the three custom fields must be provided if you want to add region.
A conversion function is used to determine the valid regionId, regionCode, and region Name based on whichever of the fields is provided.
If no custom field is provided, no error will occur. In such cases, a null region object is added, which is acceptable as many countries in the Magento API do not have a region.
Example region id: 19
Example region code: GA
Example region: Georgia
Mapping Type | Source Field (iPaaS) | Destination Field (Magento) | Description |
Field | City | City |
|
Dynamic Formula |
| CountryId | The code calls an asynchronous method GetCountryCode(Country) to fetch the valid country ID created in Magento. It stores the result in the countryId variable. Country Field is iPaaS address country. It returns the countryId as a string, using the null-conditional operator (?.) to avoid a null reference exception. If countryId is null, it returns null. |
Dynamic Formula |
| CustomerId | To perform a standalone transfer of a customer address, the customer ID is required. The method GetExternalIdAsync is used to retrieve the external ID of the customer. If the customer exists, it returns the corresponding ID; otherwise, it returns null. |
Field | IsPrimaryBilling | DefaultBilling |
|
Field | IsPrimaryShipping | DefaultShipping |
|
Field | FirstName | FirstName |
|
Field | LastName | LastName |
|
Field | PostalCode | PostalCode |
|
Dynamic Formula |
| RegionId | Returns the valid region ID after verifying the entered region ID from custom fields (M2_CustomerAdd_Regionid) Uses values provided in the address custom fields. The country value is retrieved from the country field within the address. Region ID, Code, and Name are used to validate the region against the specified country ID. If the region ID is missing or incorrect, it attempts to find a valid region using the code or name as fallback. fetch a valid region Id using the code or name instead. |
Dynamic Formula |
| Street | This returns the concatenated Address1, Address2, and Address3 into a single string separated by |, only if each part is not null or empty. It returns the final combined address string, skipping any empty fields. |
Field | PhoneNumber | Telephone |
|
Dynamic Formula |
| RegionCode | Returns the valid Region Code after verifying the entered Region Code from custom field (M2_CustomerAdd_RegionCode) Uses values provided in the address custom fields. The country value is retrieved from the country field within the address. Region ID, Code, and Name are used to validate the region against the specified country Code. If the region Code from custom field is missing or incorrect, it attempts to find a valid region using the Id or Name as fallback, fetch a valid region code using the id or name instead. |
Dynamic Formula |
| Region_ | Returns the valid Region Name after verifying the entered Region Name from custom fields (M2_CustomerAdd_Region) Uses values provided in the address custom fields. The country value is retrieved from the country field within the address. Region ID, Code, and Name are used to validate the region against the specified country ID. If the region Name is missing or incorrect, it attempts to find a valid region using the Code or Id as fallback. If valid region not found it will return null. |
Error Handling
Invalid Group/Company Mapping
Description: Dynamic formula returned null or invalid ID.
Resolution: Verify mappings exist in Magento.
Missing Primary Address.
Description: No default billing or shipping set.
Resolution: Mark at least one address as primary.
Invalid Region Info.
Description: Region fields missing or invalid.
Resolution: Provide valid RegionId, RegionCode, or Region.
Testing & Validation
Validation Checklist
Region formula must get accurate RegionId.
At least one address marked as primary billing/shipping.
Test Scenarios
Sync a new customer with both billing and shipping addresses: Verify successful creation.
Update existing customer address: Ensure updates apply without duplication.
Missing primary address: Verify error handling triggers correctly.
Additional Notes
Always sync the parent customer before syncing addresses.
Ensure dynamic formulas return valid references for all dependent entities.
For countries without regions, null values for region fields are acceptable.
