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
64 stars 47 forks source link

Contact and Account objects being created instead of single PersonAccount object #107

Closed nek4life closed 2 years ago

nek4life commented 2 years ago

Describe the bug When customer register for the site or login an Account and Contact object are created inside core instead of a single PersonAccount object. I didn't realize this at first until I started browsing existing PersonAccounts in our org and noticed that different fields show up.

To Reproduce Steps to reproduce the behavior:

  1. Deploy to full sandbox with .env that has personaccounts enabled
  2. Follow all connection steps
  3. Register a user
  4. See Contact and Account records created

Expected behavior Record should be represented as a single PersonAccount record

jbachelet commented 2 years ago

Hello @nek4life ,

Thank for opening an issue here. This is not an issue actually, this is how Salesforce Core is designed, PersonAcounts are a mix of Account & Contact record, thus two records are technically created under the hood, but only one record is used within the Code/UI/API... Please make sure you understand the PersonAccount concept and how Salesforce Core works prior to using this framework.

This is, anyway, not related to the framework.

nek4life commented 2 years ago

Hi @jbachelet ,

Thanks for your help on this.

So we have PersonAccounts and I understand the concept and how they are combined. Here is an example of a PersonAccount in our system which has a combined record.

Screen Shot 2022-01-28 at 11 46 46 AM

Here is an example of the Business Account that is created by the connector along with a linked contact.

Screen Shot 2022-01-28 at 11 47 00 AM

Should these both not be PersonAccounts?

Charlie

jbachelet commented 2 years ago

Hey @nek4life , I think this is related to the discussion #103.

I did the PR#114 (https://github.com/SalesforceCommerceCloud/b2c-crm-sync/pull/114), would you be able to deploy this branch to your org and test it within your context, please?

Thanks!

nek4life commented 2 years ago

@jbachelet if I redeploy metadata does that wipe out existing settings? We're working against a full sandbox and not a scratch org.

jbachelet commented 2 years ago

@nek4life You can just deploy the changed metadata from the PR, this will be a "merge" deploy, and so won't wipe out any existing metadata. But, if you changed some custom metadata values in the B2C CRM Sync Settings, those will be wiped out to what is deployed if you deploy this metadata.

nek4life commented 2 years ago

Thanks @jbachelet

Is this the command I need to run npm run crm-sync:sf:org:deploy reading through the docs this states it will purge the contents of the connectedApps, cspTrustedSites, duplicateRules, namedCredentials, and remoteSiteSettings meta-data folders.

Are these local folders? Sorry I'm still very new to service cloud / core development and want to make sure I'm not going to blow everything away.

As a side note it would be great to have instructions on how to update a configured instance. Appreciate all your help here.

jbachelet commented 2 years ago

Hey @nek4life ,

No, you should not use the framework CLI commands here, as these are intended to be used during the initial installation. You should use the SFDX commands.

I know that this repository lacks of upgrade documentation, but this is, from my POV, more a general understanding of how Salesforce Core deployment works. If you understand how to deploy a package, or some metadata with SFDX (or another tool), then you can basically update the b2c-crm-sync framework without any issue.

In your case, I recommend you to use

sfdx force:source:deploy -u <your-org-username> -p "./src/sfdx/base/main/default/customMetadata/B2C_CRMSync_Setting.Default_Configuration.md-meta.xml,./src/sfdx/base/main/default/flows/B2CContactProcess.flow-meta.xml,./src/sfdx/base/main/default/layouts/B2C_CRMSync_Setting__mdt-B2C CRM Sync Setting Layout.layout-meta.xml,./src/sfdc/base/main/default/objects/B2C_CRMSync_Setting__mdt/fields/PersonAccount_Record_Type_Developername__c.field-meta.xml,./src/sfdc/personaccounts/main/default/customMetadata/B2C_CRMSync_Setting.Default_Configuration.md-meta.xml"

This should only deploy the files changed in the PR

nek4life commented 2 years ago

This is all set now with the custom metadata setting. @jbachelet thanks for the help! Sorry it took so long for me to verify. We were having upstream issues in the project that was preventing me from testing.