SalesforceCommerceCloud / b2c-crm-sync

... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
https://salesforcecommercecloud.github.io/b2c-crm-sync/
BSD 3-Clause "New" or "Revised" License
65 stars 45 forks source link

Customer set to not exported when processing order creation #173

Closed ajimeneg closed 1 year ago

ajimeneg commented 2 years ago

Hi,

I noticed that in the following line: https://github.com/SalesforceCommerceCloud/b2c-crm-sync/blob/358c2e94d1fa69f24804e05465b37fddf852496d/src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/b2ccrmsync/hooks/order.process.js#L77

the model status is set to not exported. But previously in this line: https://github.com/SalesforceCommerceCloud/b2c-crm-sync/blob/358c2e94d1fa69f24804e05465b37fddf852496d/src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/b2ccrmsync/hooks/order.process.js#L61

the model is set to customer model object or order model object, depending if there is a customer with a profile in the order.

So, if you have a customer, which was already successfully exported during registration, and this customer creates an order, through this code the customer is set as "Not exported" again. Is this intended?

In the next steps, in the following line: https://github.com/SalesforceCommerceCloud/b2c-crm-sync/blob/358c2e94d1fa69f24804e05465b37fddf852496d/src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/b2ccrmsync/hooks/order.process.js#L86

the model is set to the order model object, and after that, the status of model (model is order model object) is updated. But the customer status is not set as exported anymore.

Maybe in this line https://github.com/SalesforceCommerceCloud/b2c-crm-sync/blob/358c2e94d1fa69f24804e05465b37fddf852496d/src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/b2ccrmsync/hooks/order.process.js#L77

it should be previously checked if model is an order model object before setting model as not exported? That would make sense for me.

Regards Antonio