Unable to fetch Person Account RecordType changes

Issue #1734 resolved
Rob Alexander created an issue

With PersonAccount enabled, Illuminated Cloud fails to retrieve person account metadata for RecordType changes.

It tries to find PersonAccount RecordType on Account and fails with:

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

Comments (7)

  1. Scott Wells repo owner

    Rob, IC should just be presenting the metadata types/objects that are enumerated by the server. Have you updated IC's metadata cache since enabling person accounts? I know that can change the metadata shape slightly and I wonder if it's trying to retrieve using dated metadata types/names. You can refresh the metadata cache in either the retrieval dialog or the subscription editor.

  2. Rob Alexander reporter

    Scott, my org's had person accounts enabled since before I started working on it. I refresh my metadata cache frequently.

    I found a workaround: I edited the RecordType entry in my IML file to be PersonAccount.PersonAccount instead of Account.PersonAccount and that worked.

    I wonder if what I was seeing might be related to one or both of these issues:

  3. Scott Wells repo owner

    Thanks for the info, Rob. There are certainly times when the metadata listed by Salesforce in their discovery APIs doesn't match the metadata expected by Salesforce in their mutation APIs and IC has to accommodate for those differences to make things work. It sounds like this may be another instance of that type of issue. I'll set up an org with person accounts shortly and see if I can reproduce it. I'll keep you posted here.

  4. Scott Wells repo owner

    Working on this now. It's definitely an issue with how Salesforce enumerates metadata types/objects vs. what it then expects when working with those objects. Removing IC2 from the mix, here's the result of listing metadata using the Salesforce CLI:

    $ sfdx force:mdapi:listmetadata -m RecordType
    [
      {
        createdById: '0055B000004fDg4QAE',
        createdByName: 'Automated Process',
        createdDate: '2020-11-09T21:17:28.000Z',
        fileName: 'objects/Metric.object',
        fullName: 'Metric.Progress',
        id: '0125B000001FcLDQA0',
        lastModifiedById: '0055B000004fDg4QAE',
        lastModifiedByName: 'Automated Process',
        lastModifiedDate: '2020-11-09T21:17:28.000Z',
        manageableState: 'unmanaged',
        type: 'RecordType'
      },
      {
        createdById: '0055B000004fDfyQAE',
        createdByName: 'User User',
        createdDate: '2020-11-09T21:21:51.000Z',
        fileName: 'objects/Account.object',
        fullName: 'Account.PersonAccount',
        id: '0125B000001FcPgQAK',
        lastModifiedById: '0055B000004fDfyQAE',
        lastModifiedByName: 'User User',
        lastModifiedDate: '2020-11-09T21:21:51.000Z',
        manageableState: 'unmanaged',
        type: 'RecordType'
      },
      {
        createdById: '0055B000004fDg4QAE',
        createdByName: 'Automated Process',
        createdDate: '2020-11-09T21:17:28.000Z',
        fileName: 'objects/Metric.object',
        fullName: 'Metric.Completion',
        id: '0125B000001FcLEQA0',
        lastModifiedById: '0055B000004fDg4QAE',
        lastModifiedByName: 'Automated Process',
        lastModifiedDate: '2020-11-09T21:17:28.000Z',
        manageableState: 'unmanaged',
        type: 'RecordType'
      },
      {
        createdById: '0055B000004fDfyQAE',
        createdByName: 'User User',
        createdDate: '2020-11-09T21:21:48.000Z',
        fileName: 'objects/Account.object',
        fullName: 'Account.Business_Account',
        id: '0125B000001FcPfQAK',
        lastModifiedById: '0055B000004fDfyQAE',
        lastModifiedByName: 'User User',
        lastModifiedDate: '2020-11-09T21:21:48.000Z',
        manageableState: 'unmanaged',
        type: 'RecordType'
      }
    ]
    

    As you can see, the list includes Account.PersonAccount. If I then try to retrieve metadata with that name, nothing is retrieved:

    $ sfdx force:source:retrieve -m RecordType:Account.PersonAccount
    === Retrieved Source
    No results found
    

    If I instead try to retrieve it using the modified name PersonAccount.PersonAccount, it's retrieved just fine:

    $ sfdx force:source:retrieve -m RecordType:PersonAccount.PersonAccount
    === Retrieved Source
    FULL NAME                    TYPE        PROJECT PATH
    ───────────────────────────  ──────────  ──────────────────────────────────────────────────────────────────────────────────────────
    PersonAccount.PersonAccount  RecordType  force-app\main\default\objects\PersonAccount\recordTypes\PersonAccount.recordType-meta.xml
    

    The same holds for deployment. I can update IC2 to do this same type of automatic correction. I want to see whether there are other instances of the same problem, though, so I can address them all at once instead of onesy-twosy.

  5. Scott Wells repo owner

    Fix committed that translates known, incorrectly-reported PersonAccount metadata to the corrected names.

  6. Log in to comment