Skip to Content
Technical Articles

Migrating Customer Data from SAP Commerce Cloud to SAP Customer Data Cloud

SAP Customer Data Cloud offers best-in-class Customer Identity and Access Management (CIAM) features such as customized registration, user profile and preference management, user engagement and loyalty, integration with third-party social, marketing and service platforms, and so on. When integrated with SAP Commerce Cloud, you can leverage these powerful capabilities to deliver exceptional customer experience through your e-commerce platform.

As an SAP Commerce Cloud administrator, you would want to migrate your existing customer database to SAP Customer Data Cloud. In this blog, we show you how.

Prerequisites

Before getting started, ensure that:

  • You are running SAP Commerce Cloud version 1811 or higher.
  • You have a valid Amazon Web Services (AWS) subscription with the service key for the object store. This allows you to temporarily store the data in CSV file format and access it through SFTP.
  • You have set up your site in SAP Customer Data Cloud (see Site Setup).
  • You have added the following dataflows to your SAP Customer Data Cloud site (see IdentitySync Implementation):
    • Import from SFTP to Gigya: Registers customers with SAP Customer Data Cloud
      {
       "name": "Import from SFTP to Gigya",
       "description": "sftp > dsv > rename > account",
      "steps": [
        {
         "id": "sftp",
         "type": "datasource.read.amazon.s3",
         "params": {
          "fileNameRegex": "<CustomerDataFromCommerce.csv>",
          "bucketName": "<AWS bucket name>",
          "accessKey": "<AWS access key>",
          "secretKey": "<AWS secret key>"
         },
         "next": [
          "dsv"
         ]
        },
        {
         "id": "dsv",
         "type": "file.parse.dsv",
         "params": {
          "columnSeparator": ";",
          "addFilename": false,
          "inferTypes": true
         },
         "next": [
          "gigya.generic - initRegistration"
         ]
        },
        {
         "id": "gigya.generic - initRegistration",
         "type": "datasource.write.gigya.generic",
         "params": {
          "apiMethod": "accounts.initRegistration",
          "maxConnections": 5,
          "apiParams": [
           {
            "sourceField": "",
            "paramName": "isLite",
            "value": "FALSE"
           },
           {
            "sourceField": "",
            "paramName": "dataCenter",
            "value": "<Site Data Centre>"
           }
          ],
          "addResponse": true
         },
         "next": [
          "field.add"
         ]
        },
        {
         "id": "gigya.generic - Copy",
         "type": "datasource.write.gigya.generic",
         "params": {
          "apiMethod": "accounts.register",
          "maxConnections": 10,
          "apiParams": [
           {
            "sourceField": "originalUid",
            "paramName": "email",
            "value": ""
           },
           {
            "sourceField": "_response.regToken",
            "paramName": "regToken",
            "value": ""
           },
           {
            "sourceField": "preferences",
            "paramName": "preferences",
            "value": ""
           },
           {
            "sourceField": "",
            "paramName": "lang",
            "value": "en"
           },
           {
            "sourceField": "",
            "paramName": "finalizeRegistration",
            "value": "true"
           },
           {
            "sourceField": "password",
            "paramName": "password",
            "value": ""
           },
           {
            "sourceField": "profile",
            "paramName": "profile",
            "value": ""
           }
      *If you have more fields that need to be modified and sent to SAP Customer Data Cloud, add it here. Else, remove this line.*
          ],
          "addResponse": true,
          "secret": "<Secret associated with user key>",
          "apiKey": "<Site API key to submit API call>",
          "userKey": "<User key to send API call>"
         },
         "next": [
          "record.evaluate - response"
         ]
        },
        {
         "id": "field.add",
         "type": "field.add",
         "params": {
          "fields": [
           {
            "field": "preferences.terms.mandatory.electronics.isConsentGranted",
            "value": "true"
           },
      *If you have mandatory consents defined on the site, add them here as done above. Else, remove this line.*
           {
            "field": "profile.firstName",
            "value": ""
           },
           {
            "field": "profile.lastName",
            "value": ""
           },
           {
            "field": "password",
            "value": ""
           }
          ]
         },
         "next": [
          "Process Name & Password"
         ]
        },
        {
         "id": "Process Name & Password",
         "type": "record.evaluate",
         "params": {
          "script": "ZnVuY3Rpb24gcHJvY2VzcyhyZWNvcmQsIGN0eCwgbG9nZ2VyLCBuZXh0KSB7CiAgIGlmKHJlY29yZCAhPT0gbnVsbCl7CiAgICAgICB2YXIgZmlyc3ROYW1lID1yZWNvcmQubmFtZS5zcGxpdCgiICIpWzBdOwogICAgICAgcmVjb3JkLnByb2ZpbGUuZmlyc3ROYW1lID0gZmlyc3ROYW1lOwogICAgICAgdmFyIGxhc3ROYW1lID0gcmVjb3JkLm5hbWUuc3BsaXQoIiAiKVsxXTsKICAgICAgIHJlY29yZC5wcm9maWxlLmxhc3ROYW1lID0gbGFzdE5hbWU7CiAgICAgICByZWNvcmQucGFzc3dvcmQgPSBNYXRoLnJhbmRvbSgpLnRvU3RyaW5nKDM2KS5zbGljZSgtOCk7CiAgIH0KICAgcmV0dXJuIHJlY29yZDsKfQ==",
          "notifyLastRecord": true
         },
         "next": [
          "gigya.generic - Copy"
         ]
        },
        {
         "id": "record.evaluate - response",
         "type": "record.evaluate",
         "params": {
          "script": "ZnVuY3Rpb24gcHJvY2VzcyhyZWNvcmQsIGN0eCwgbG9nZ2VyLCBuZXh0KSB7CiAgIGxvZ2dlci5pbmZvKCJSZXNwb25zZSBNZXNzYWdlIiwgcmVjb3JkKTsKICAgcmV0dXJuIHJlY29yZDsKfQ==",
          "notifyLastRecord": false
         },
         "next": []
        }
       ]
      }

 

    • Export New Users from Gigya to S3: Exports SAP Customer Data Cloud UIDs and stores them in AWS
      {
       
       "name": "Export new users from Gigya to S3",
       "description": "account > rename > dsv > gzip > sftp",
       "steps": [
        {
         "id": "account",
         "type": "datasource.read.gigya.audit",
         "params": {
          "select": "UID, profile.email",
          "where": "endpoint = 'accounts.register'",
          "deltaField": "@timestamp",
          "keepFieldNamesWithDotAsIs": false,
          "from": "audit"
         },
         "next": [
          "field.add"
         ]
        },
        {
         "id": "dsv",
         "type": "file.format.dsv",
         "params": {
          "fileName": "<UserWithGigyaUid.csv>",
          "columnSeparator": ";",
          "quoteFields": false,
          "maxFileSize": 500,
          "escapeCharacter": ";",
          "writeHeader": true,
          "createEmptyFile": false,
          "quoteHeader": false,
          "lineEnd": "\n"
         },
         "next": [
          "s3"
         ]
        },
        {
         "id": "s3",
         "type": "datasource.write.amazon.s3",
         "params": {
          "bucketName": "<AWS bucket name>",
          "accessKey": "<AWS access key>",
          "secretKey": "<AWS secret key>"
         }
        },
        {
         "id": "field.rename",
         "type": "field.rename",
         "params": {
          "fields": [
           {
            "sourceField": "params.email",
            "targetField": "uid[unique=true]"
           },
           {
            "sourceField": "uid",
            "targetField": "gyUid"
           }
          ]
         },
         "next": [
          "field.remove"
         ]
        },
        {
         "id": "field.remove",
         "type": "field.remove",
         "params": {
          "fields": [
           "callID",
           "params",
           "userAgent",
           "httpReq",
           "authType",
           "@timestamp",
           "errCode",
           "errMessage",
           "errDetails",
           "endpoint",
           "ip",
           "apikey",
           "uid",
           "userKey",
           "userKeyDetails"
      *If any other fields are populated by default, add them here to remove them. Else, remove this line.*
          ]
         },
         "next": [
          "dsv"
         ]
        },
        {
         "id": "field.add",
         "type": "field.add",
         "params": {
          "fields": [
           {
            "field": "INSERT_UPDATE Customer",
            "value": " "
           }
          ]
         },
         "next": [
          "field.rename"
         ]
        }
       ]
      }

 

    • Reset Password for New Accounts: Sends an email requesting customers to reset their password
      {
       "name": "Reset Password for new accounts",
       "description": "sftp > dsv > rename > account",
       "steps": [
        {
         "id": "sftp",
         "type": "datasource.read.amazon.s3",
         "params": {
          "fileNameRegex": "<CustomerDataFromCommerce.csv>",
          "bucketName": "<AWS bucket name>",
          "accessKey": "<AWS access key>",
          "secretKey": "<AWS secret key>"
         },
         "next": [
          "dsv"
         ]
        },
        {
         "id": "dsv",
         "type": "file.parse.dsv",
         "params": {
          "columnSeparator": ";",
          "addFilename": false,
          "inferTypes": true
         },
         "next": [
          "gigya.generic - resetPassword"
         ]
        },
        {
         "id": "record.evaluate - response",
         "type": "record.evaluate",
         "params": {
          "script": "ZnVuY3Rpb24gcHJvY2VzcyhyZWNvcmQsIGN0eCwgbG9nZ2VyLCBuZXh0KSB7CiAgIGxvZ2dlci5pbmZvKCJlbWFpbCBzZW50IHJlY29yZCIsIHJlY29yZCk7CiAgIHJldHVybiByZWNvcmQ7Cn0=",
          "notifyLastRecord": false
         },
         "next": []
        },
        {
         "id": "gigya.generic - resetPassword",
         "type": "datasource.write.gigya.generic",
         "params": {
          "apiMethod": "accounts.resetPassword",
          "maxConnections": 10,
          "apiKey": "<Site API key to sumbit API call>",
          "userKey": "<User key to send API call>",
          "secret": "<Secret associated with user key>",
          "apiParams": [
           {
            "sourceField": "originalUid",
            "paramName": "loginID",
            "value": ""
           }
          ],
          "addResponse": false
         },
         "next": [
          "record.evaluate - response"
         ]
        }
       ]
      }​

 

Procedure

Follow these steps to migrate customer data:

  1. Export customer data from SAP Commerce Cloud as a CSV file by importing the following ImpEx code in SAP Commerce Administration Console:
    "#% impex.setTargetFile( ""<CustomerDataFromCommerce.csv>"" );"
    insert_update Customer;name;originalUid *Add fields here if required. Else, delete this line.*
    
    "#% impex.exportItems( ""SELECT {CUST:pk} FROM {Customer as CUST} where {CUST:deactivationDate} is null and {CUST: gyUid} is null and {CUST:pk} not in ({{select {B2BCUST:pk} from {B2BCustomer as B2BCUST}}})"" , Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1   );"
    ​
  2. Extract the downloaded ZIP file.
  3. Open the CSV file, remove # from the first line and save it.
  4. Copy the CSV file to AWS object store.
  5. Run Import from SFTP to Gigya dataflow in SAP Customer Data Cloud.
  6. Run Export New Users from Gigya to S3 dataflow in SAP Customer Data Cloud. A new CSV file is saved to the AWS object store – copy it to your local system.
  7. Copy the content of the new CSV file and import it as ImpEx code in SAP Commerce Administration Console.
  8. Upgrade your SAP Commerce Cloud instance to the SAP Customer Data Cloud integrated storefront (see SAP Customer Data Cloud Integration Implementation).
  9. Run Reset Password for New Accounts dataflow in SAP Customer Data Cloud.

Note:

  • The procedure must be repeated if new customer accounts were created in SAP Commerce Cloud during the migration.
  • Currently, B2B scenario is not supported.

And that’s it! Your customer data is successfully migrated and ready for the newly integrated systems.

/
1 Comment
You must be Logged on to comment or reply to a post.
  • Hi Rejin Varghese,

     

    We are in the process to migrate Hybris customer accounts to Gigya. This is a great article. I’ve a few questions after going through it:

    1. In your JSON example, you have left the password field blank. Will Gigya still be able to import the file?
    2. Point#7Copy the content of the new CSV file and import it as ImpEx code in SAP Commerce Administration Console. – Does this CSV contain the customer data with Gigya ID?
    3. You have mentioned that after importing the user accounts to Gigya, customers need to be sent an email communication to reset their passwords (Point#9Run Reset Password for New Accounts dataflow in SAP Customer Data Cloud). The question is: At the time of resetting the password, how does Gigya decide if the customer has entered the correct old password in the reset password form (Gigya doesn’t have the old password of the customer) -OR- Does Gigya simply ask for the new password i.e. not require the customer to enter the old password?

     

    Thanks,

    Arvind Kumar Avinash