SFDO-Tooling / CumulusCI

Python framework for building portable automation for Salesforce projects

Home Page:http://cumulusci.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is_person_type error when running snowfakery

tcdahlberg opened this issue · comments

Describe the bug

After upgrading to the recent version of cci (3.84.0) I get an error when running my snowfakery recipe that previously ran. I get this error:

Error: is_person_type

Which I am guessing may be a shift to a person account model.

Reproduction steps

  1. Add an EDA dependency to cumulus.yml
  dependencies:
    - github: 'https://github.com/SalesforceFoundation/EDA'
  1. Add this task to cumulus.yml
  create_fake_school_data:
    description: Makes fake account data to mimic schools with Educaiton as industry
    class_path: cumulusci.tasks.bulkdata.snowfakery.Snowfakery
    options:
      recipe: datasets/snowfakery/fake_schools.yml
  1. Add the dataset recipe
- object: Account
  count: 1000
  fields:
    Name:
      random_choice:
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} University
        - choice:
            probability: 25%
            pick: ${{fake.city}} University
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} College
        - choice:
            probability: 25%
            pick: ${{fake.city}} College
    BillingCity:
      fake: city
    BillingStreet:
      fake: street_address
    BillingState:
      fake: State
    BillingCountry:
      fake: CurrentCountry
    Industry: Education
    Type: College
    RecordType: Educational_Institution
- object: Account
  count: 1000
  fields:
    Name:
      random_choice:
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} High School
        - choice:
            probability: 25%
            pick: ${{fake.city}} High School
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} Senior High
        - choice:
            probability: 25%
            pick: ${{fake.city}} Senior High
    BillingCity:
      fake: city
    BillingStreet:
      fake: street_address
    BillingState:
      fake: State
    BillingCountry:
      fake: CurrentCountry
    Industry: Education
    Type: High School
    RecordType: Educational_Institution

  1. Run the task after the scratch org builds
cci task info snowfakery

Your CumulusCI and Python versions

CumulusCI version: 3.84.0
Python version: 3.10.2

Operating System

WIndows 11

Windows environment

PowerShell

CumulusCI installation method

pipx

Error Gist

No response

Additional information

No response

I built a clean cci project with the error in this repo:
https://github.com/tcdahlberg/cci_is_person_type_error

Note: The error does not happen if EDA is not a dependency, so perhaps it is on the EDA side? I will try to investigate that angle.

If you run without the EDA dependency you will have to comment out the RecordType: Education_Institution in the snowfakery recipe.

I also commented out Account_Integration_External_ID__c: ${{id}} in the snofakery recipe because that was a field on the project I was working on.

When running a build with the debug flag I get this error:

Traceback (most recent call last):
  File "C:\Users\Big-Top\.local\pipx\venvs\cumulusci\lib\site-packages\sqlalchemy\sql\base.py", line 1223, in __getattr__
    return self._index[key]
KeyError: 'is_person_type'

I am facing the same error : is_person_type (with 3.84) and my project does not use EDA at all.
I think error is raised every time you load sample data with object that has a record type and target org is not having person accounts enabled.

I think issue is around here

# Combination of IsPersonType and DeveloperName is unique

@rlilov , I think you are right. I am running into the error now when loading regular datasets (not snowfakery) now.

This error started happening starting with 3.84. Our scratch orgs DO have person accounts enabled and do NOT have EDA at all, it is a completely custom build.

Oh, I just realized, my org I am importing into was not created by CumulusCI, it is an imported org using cci org import this means the self.org_config.is_person_accounts_enabled may not be accurate? It does look like it is supposed to be checking the org though.

There is a fix already, looks like it is related to older load files #3739

@tcdahlberg Thanks for the report. Fixed in #3739.