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

Error while running deploy step to standard org with PersonAccounts enabled #104

Open nek4life opened 2 years ago

nek4life commented 2 years ago

Describe the bug While executing the following command from the documentation https://github.com/SalesforceCommerceCloud/b2c-crm-sync#deploy-the-b2c-crm-sync-application-code-to-your-salesforce-org I receive the following error

  ,----------------------------------------------------------------------.
  |                                                                      |
  |                                                                      |
  |  88888888888                                                   88    |
  |  88                                                            88    |
  |  88                                                            88    |
  |  88aaaaa      8b,dPPYba,  8b,dPPYba,   ,adPPYba,   8b,dPPYba,  88    |
  |  88"""""      88P'   "Y8  88P'   "Y8  a8"     "8a  88P'   "Y8  88    |
  |  88           88          88          8b       d8  88          ""    |
  |  88           88          88          "8a,   ,a8"  88          aa    |
  |  88888888888  88          88           `"YbbdP"'   88          88    |
  |                                                                      |
  |                                                                      |
  |                      Oh no! Not one of these :(                      |
  |                                                                      |
  |         It looks like you've run into an error or exception.         |
  |                       Please log an issue via                        |
  |   https://github.com/SalesforceCommerceCloud/b2c-crm-sync/issues.    |
  |    That's the best way to engage us. Thank you for your support!     |
  |                                                                      |
  `----------------------------------------------------------------------'

[
  {
    "stack": "DeployFailed: Deploy failed.\n    at /Users/choinierec/projects/b2c-crm-sync/node_modules/salesforce-alm/dist/lib/source/sourceApiCommand.js:71:31\n    at async SourceDeployCommand.execLegacyCommand (/Users/choinierec/projects/b2c-crm-sync/node_modules/salesforce-alm/dist/ToolbeltCommand.js:149:29)\n    at async SourceDeployCommand.run (/Users/choinierec/projects/b2c-crm-sync/node_modules/salesforce-alm/dist/commands/force/source/deploy.js:32:16)\n    at async SourceDeployCommand._run (/Users/choinierec/projects/b2c-crm-sync/node_modules/@salesforce/command/lib/sfdxCommand.js:81:40)",
    "message": "Deploy failed.",
    "name": "DeployFailed",
    "actions": [
      "Check the order of your dependencies and ensure all metadata is included."
    ],
    "exitCode": 1,
    "columns": [
      {
        "key": "problemType",
        "label": "TYPE"
      },
      {
        "key": "filePath",
        "label": "PROJECT PATH"
      },
      {
        "key": "error",
        "label": "PROBLEM"
      }
    ],
    "data": [
      {
        "columnNumber": "16",
        "lineNumber": "770",
        "error": "Could not resolve list view column: ACCOUNT.RECORDTYPE (770:16)",
        "fullName": "Contact.Non_B2C_Commerce_Customer_Profiles",
        "type": "ListView",
        "filePath": "src/sfdc/base/main/default/objects/Contact/listViews/Non_B2C_Commerce_Customer_Profiles.listView-meta.xml",
        "problemType": "Error",
        "height": 1
      },
      {
        "error": "lookupPhoneDialogsAdditionalFields ACCOUNT.PHONE1 not found",
        "fullName": "Contact",
        "type": "CustomObject",
        "filePath": "src/sfdc/base/main/default/objects/Contact/Contact.object-meta.xml",
        "problemType": "Error",
        "height": 1
      }
    ],
    "commandName": "SourceDeployCommand",
    "code": "Error"
 }
]

To Reproduce Steps to reproduce the behavior:

  1. Use full sandbox (non-scratch org)
  2. Have PersonAccounts enabled
  3. Follow all instructions up to the deploy step
  4. Run npm run crm-sync:sf:org:deploy

Expected behavior Deploy should succeed

local environment details

Node version v14.18.3 NPM version 6.14.15 SFDX version sfdx-cli/7.132.0 darwin-x64 node-v16.13.1 Your remote environment details:

Salesforce B2C Commerce version: 22.1 compat 21.2 Salesforce Core version: ??

filipecarvalho15 commented 2 years ago

I had this problem, my advice is go the easy way and delete the list view and remove the bad field

nek4life commented 2 years ago

@filipecarvalho15 thanks for letting me know you ran into the same thing. I have tried removing the specific fields, but then ran into more errors. I will try removing the entire list view and see if the deployment will continue.

nek4life commented 2 years ago

Deleting:

<columns>ACCOUNT.RECORDTYPE</columns>
<columns>ACCOUNT.TYPE</columns>

src/sfdc/base/main/default/objects/Contact/listViews/Non_B2C_Commerce_Customer_Profiles.listView-meta.xml

and deleting

    <lookupPhoneDialogsAdditionalFields>CONTACT.PHONE6</lookupPhoneDialogsAdditionalFields>

src/sfdc/base/main/default/objects/Contact/Contact.object-meta.xml

Allowed the base metadata to deploy.

I now get an error with the PersonAccount metadata

[
  {
    "stack": "DeployFailed: Deploy failed.\n    at /Users/choinierec/projects/b2c-crm-sync/node_modules/salesforce-alm/dist/lib/source/sourceApiCommand.js:71:31\n    at async SourceDeployCommand.execLegacyCommand (/Users/choinierec/projects/b2c-crm-sync/node_modules/salesforce-alm/dist/ToolbeltCommand.js:149:29)\n    at async SourceDeployCommand.run (/Users/choinierec/projects/b2c-crm-sync/node_modules/salesforce-alm/dist/commands/force/source/deploy.js:32:16)\n    at async SourceDeployCommand._run (/Users/choinierec/projects/b2c-crm-sync/node_modules/@salesforce/command/lib/sfdxCommand.js:81:40)",
    "message": "Deploy failed.",
    "name": "DeployFailed",
    "actions": [
      "Check the order of your dependencies and ensure all metadata is included."
    ],
    "exitCode": 1,
    "columns": [
      {
        "key": "problemType",
        "label": "TYPE"
      },
      {
        "key": "filePath",
        "label": "PROJECT PATH"
      },
      {
        "key": "error",
        "label": "PROBLEM"
      }
    ],
    "data": [
      {
        "columnNumber": "18",
        "lineNumber": "268",
        "error": "In field: RecordType - no RecordType named PersonAccount.PersonAccount found (268:18)",
        "fullName": "Account.B2C_Commerce_Customer_Profiles",
        "type": "ListView",
        "filePath": "src/sfdc/base/main/default/objects/Account/listViews/B2C_Commerce_Customer_Profiles.listView-meta.xml",
        "problemType": "Error",
        "height": 1
      },
      {
        "columnNumber": "20",
        "lineNumber": "3",
        "error": "You can't change a matching rule's status from Activating to Active. (3:20)",
        "type": "MatchingRule",
        "filePath": "N/A",
        "problemType": "Error",
        "height": 1
      }
    ],
    "commandName": "SourceDeployCommand",
    "code": "Error"
  }
]

I will try removing this file as well to see if I can deploy the person account metadata

nek4life commented 2 years ago

I removed

  <filters>
        <field>ACCOUNT.RECORDTYPE</field>
        <operation>equals</operation>
        <value>PersonAccount.PersonAccount</value>
    </filters>

from src/sfdc/personaccounts/main/default/objects/Account/listViews/B2C_Commerce_Customer_Profiles.listView-meta.xml

and was able to complete the deploy.

Has this project been tested against a sandbox org with person accounts enabled before? I'm wondering why these particular fields were causing issues.

jbachelet commented 2 years ago

Hello @nek4life , Thank you for opening an issue here.

I can see that you solved all your issues, that's great!

FYI, we are testing, for all releases, the deployment of the framework against:

Thus, to answer your question, yes this project has been tested against orgs where PersonAccounts are enabled. The issue is that you might have specific configurations/licenses on your org which makes the framework deployment breaking where it is working well on a brand new dev org/scratch org.

If you can open a pull request that removes the extra stuff not needed for a deployment, that would be awesome, otherwise, I can do it in a few weeks from now.

Thanks

nek4life commented 2 years ago

@jbachelet I can certainly add a pull request. Once we have that perhaps you'd be able to tell what functionality is missing or would be broken with the missing pieces of metadata. That's my only concern. I'm not as familiar with Service Cloud development as am with Commerce so I took a very basic approach to debugging.

jbachelet commented 2 years ago

Please do open a PR and we will take it from there. Thanks!

nek4life commented 2 years ago

Screen Shot 2022-01-28 at 11 51 38 AM

It looks like I do not have permission to fork the repository. If you can update the permissions I'd be happy to help.

Charlie

jbachelet commented 2 years ago

From your screenshot, I can see that you do. You have to click on your Github ID shown on the screen, which will fork the repository into your personal space.

nek4life commented 2 years ago

Opened #109