Magento 2 - NetSuite Integration App Customer Export Flow Look up Process

Customer Data Integration: NetSuite to Magento 2

This process ensures that customer information in NetSuite is always kept up to date in Magento 2. Whether a customer is new or an existing one, the integration automatically updates Magento so both systems are aligned, eliminating manual updates and reducing the chance of errors. Customers, their details, and their addresses stay fully synchronized across both systems.


Flow: NetSuite customer to Magento 2 customer (add/update)

How the Flow Works

  1. Get customer from NetSuite (Listener)

    • Whenever a customer record is created or updated in NetSuite, the system automatically detects it.
  2. Add or update customer to Magento 2 Import (Import)

    • The system checks if this customer already exists in Magento.

    • If the customer exists, their record is updated.

    • If the customer doesn’t exist, a new customer record is created in Magento.

  3. Add or update customer to Magento 2 (Import)

    • After a successful sync, the Magento Customer ID is written back to NetSuite.

    • This ensures both systems can “talk” to each other using the same reference ID.

  4. Write back Address IDs to NetSuite (Import)

    • Along with customer details, address records are also synced.

    • The address records are added/updated in NetSuite based on the eTail Address ID.


How the Lookup Works (Behind the Scenes)

  • Before updating Magento, the system first checks if the customer is already there.
    It uses two pieces of information to do this:

    • The customer’s email address

    • The website ID they belong to in Magento

      • The app looks up the customer in Magento using the website_id and the NATIVE NetSuite email address using a request similar to below:

  • Based on the response, we either get an error or a success.

    • If a match is found, Magento updates that customer record.

      • The customer ID will be appended here: V1/customers/{{{Magento2CustomerId}}}; otherwise, it will use the default V1/customers/me.
    • If no match is found, a new customer is created in Magento.

      • Since the app is still trying to add/update the customer, it will still send the request similar to the one below:


Outcome

  • If the sync is successful, the customer record in Magento reflects the latest details from NetSuite.

  • If an error occurs, it’s logged so that the issue can be quickly resolved.

2 Likes