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.
Before getting started, ensure that:
{
"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": []
}
]
}
{
"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"
]
}
]
}
{
"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"
]
}
]
}
"#% 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 );"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |