5

Here is my issue: ERROR: Entity of type 'RecordType' named 'Account.Business_Account' cannot be found.

What I did

  • Converted existing managed package into SF DX project.

  • The project uses PersonAccount and State and Country/Territory Picklists.

My steps

  • Check sfdx version:
$ sfdx -v

sfdx-cli/6.1.19 (darwin-x64) node-v9.4.0

$ sfdx plugins

no plugins installed
  • Create new scratch org, org definition:
{
    "orgName": "basepack1",
    "edition": "Enterprise",
    "country": "US",
    "description": "",
    "hasSampleData": "false",
    "features": ["PersonAccounts"],
    "orgPreferences": {
        "enabled": ["S1DesktopEnabled"]
    }
}
  • Before first push check remote status:
$ sfdx force:source:status -r

=== Source Status
STATE       FULL NAME                 TYPE        PROJECT PATH
Remote Add  Account.Business_Account  RecordType
  • Try to pull even with -f and see the error:
$ sfdx force:source:pull

ERROR:  Entity of type 'RecordType' named 'Account.Business_Account'
cannot be found.
  • Open scratch org, enable State&Countries, then PUSH project, create new PermSet no problems here.

  • Check status local and remote:

$ sfdx force:source:status

=== Source Status
STATE       FULL NAME                 TYPE           PROJECT PATH
Remote Add  Account.Business_Account  RecordType
Remote Add  Address                   Settings
Remote Add  ScratchPermSet            PermissionSet
  • Try to pull even with -f flag, same problem.
$sfdx force:source:pull -f

ERROR:  Entity of type 'RecordType' named 'Account.Business_Account'
cannot be found.

What I tried so far:

  1. Add to .forceignore this line: force-app/main/default/objects/Account/recordTypes/Business_Account.recordType-meta.xml

UPD

I was able to reproduce the issue using clean project. I assume my project is not corrupted and it is a bug.

The issue is in Scratch orgs with Person Account AND Namespace.

Here are the steps:

$ sfdx force:project:create -n geolocation
$ sfdx force:config:set defaultdevhubusername=_HubWithNameSpace_
set namespace in sfdx-project.json
set Person account feature in project-scratch-def.json
$ sfdx force:org:create -f config/project-scratch-def.json --setalias geons --setdefaultusername
$ sfdx force:source:status

=== Source Status
STATE FULL NAME TYPE PROJECT PATH
Remote Add Account.Business_Account RecordType

$ sfdx force:source:pull
ERROR: Entity of type 'RecordType' named 'Account.Business_Account' cannot be found.

$ sfdx force:apex:class:create -n MyClass
$ sfdx force:source:status

=== Source Status
STATE FULL NAME TYPE PROJECT PATH
Local Add MyClass ApexClass force-app/MyClass.cls
Local Add MyClass ApexClass force-app/MyClass.cls-meta.xml
Remote Add Account.Business_Account RecordType

$ sfdx force:source:push
=== Pushed Source
STATE FULL NAME TYPE PROJECT PATH
Add MyClass ApexClass force-app/MyClass.cls
Add MyClass ApexClass force-app/MyClass.cls-meta.xml

$ sfdx force:source:pull
ERROR: Entity of type 'RecordType' named 'Account.Business_Account' cannot be found.

After that you can ONLY push your changes, BUT will not be able to pull anything from org.

Please share your ideas how to solve this, thanks.

1
  • The error message makes me think that Account.Business_Account is already referenced in the meta data somewhere. Can you findAll in your source and see if anything comes up? Jan 31, 2018 at 17:54

1 Answer 1

3

I'll answer as I did find some kind of workaround

Those steps allow me to work DX-style with Managed Package, Namespace and Person Account

1 Create scratch org WITHOUT Namespace, using flag -n, --nonamespace

sfdx force:org:create -f config/project-scratch-def.json -a ScratchNONameSpace -s -n

2 First thing is to pull Account.Business_Account, which works as expected

$ sfdx force:source:status -r

=== Source Status
STATE       FULL NAME                 TYPE        PROJECT PATH
Remote Add  Account.Business_Account  RecordType

$ sfdx force:source:pull

=== Pulled SourceSTATE  FULL NAME                 TYPE        PROJECT PATH
Add    Account.Business_Account  RecordType  force-app/main/default/objects/Account/recordTypes/Business_Account.recordType-meta.xml

3 Create scratch org WITH Namespace

sfdx force:org:create -f config/project-scratch-def.json -a ScratchWithNameSpace -s

4 Check status, you'll see conflicts

$ sfdx force:source:status
=== Source Status
STATE                      FULL NAME                 TYPE        PROJECT PATH

Local Add (Conflict)       Account.Business_Account  RecordType  force-app/main/default/objects/Account/recordTypes/Business_Account.recordType-meta.xml
Remote Changed (Conflict)  Account.Business_Account  RecordType  force-app/main/default/objects/Account/recordTypes/Business_Account.recordType-meta.xml

5 Push your code using flag -f, --forceoverwrite

$ sfdx force:source:push -f
=== Pushed Source
STATE  FULL NAME                 TYPE        PROJECT PATH

Add    Account.Business_Account  RecordType  force-app/main/default/objects/Account/recordTypes/Business_Account.recordType-meta.xml

$ sfdx force:source:status
=== Source Status
No results found

After that you would be able to push/pull without issues.

2
  • How does that solve your problem with person account ? I'm facing the same issue with person account recordtype. I cannot pull my record type locally
    – brovasi
    Mar 19, 2018 at 2:15
  • Force pushing Account.Business_Account and then adding it to forceignore solves the problem for me May 2, 2018 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .