Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while trying to create Person Accounts in Salesforce with snowfakery recipe and Cumulus CI #648

Open
jorgesolebur opened this issue Apr 28, 2022 · 5 comments

Comments

@jorgesolebur
Copy link

jorgesolebur commented Apr 28, 2022

Hello

I am trying to create a simple recipe to load PersonAccounts in Salesforce:

- plugin: snowfakery.standard_plugins.Salesforce
- plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery

- object: Account
  fields:
    FirstName:
      fake: FirstName
    LastName:
      fake: LastName
    PersonMailingStreet:
      fake: StreetAddress
    PersonMailingCity:
      fake: City
    PersonContactId:
      Salesforce.SpecialObject: PersonContact

However when I run this using cumulusCI with the following command:

cci task run generate_and_load_from_yaml --org dev --bulk-mode SERIAL --generator_yaml snowflake/campaign/campaign.yaml --working_directory ./tmp/ 

I get the following error from the command:

[04/28/22 15:08:59] Field Contact.IsPersonAccount is not present or does not have the correct permissions.   

I have verified and PersonAccounts is enabled in my org, and I have tested the creation of 1 person account through UI and I can successfully create one. I am attaching the yaml file and the tmp yaml files generated. How are person accounts created? Are you first creating an account, then creating a contact for that account and updating Contact.isPesonAccount = true? I do not think that will work

Thanks in advance
Archive.zip

@jorgesolebur
Copy link
Author

Sharing the tracebok when enabling Debug Logs:

Traceback (most recent call last):
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/cli/cci.py", line 89, in main
    cli(args[1:], standalone_mode=False, obj=runtime)
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/cli/task.py", line 181, in run_task
    task()
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/core/tasks.py", line 160, in __call__
    self.result = self._run_task()
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/tasks/bulkdata/generate_and_load_data.py", line 146, in _run_task
    res = self._generate_batch(
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/tasks/bulkdata/generate_and_load_data.py", line 213, in _generate_batch
    return self._dataload(subtask_options)
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/tasks/bulkdata/generate_and_load_data.py", line 175, in _dataload
    subtask()
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/core/tasks.py", line 160, in __call__
    self.result = self._run_task()
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/tasks/bulkdata/load.py", line 121, in _run_task
    self._init_mapping()
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/tasks/bulkdata/load.py", line 511, in _init_mapping
    validate_and_inject_mapping(
  File "/Users/jsolerburguera/.local/pipx/venvs/cumulusci/lib/python3.10/site-packages/cumulusci/tasks/bulkdata/mapping_parser.py", line 517, in validate_and_inject_mapping
    raise BulkDataException(
cumulusci.core.exceptions.BulkDataException: One or more schema or permissions errors blocked the operation.
If you would like to attempt the load regardless, you can specify '-o drop_missing_schema True' on the command.

@prescod
Copy link
Contributor

prescod commented Apr 29, 2022 via email

@jorgesolebur
Copy link
Author

Thanks @prescod , I will give a try. Quick question - which command should I use among the 2 below? I am confused because both of them do similar things:

cci task run snowfakery 

or

cci task run generate_and_load_from_yaml

Thanks for the advice !

@prescod
Copy link
Contributor

prescod commented May 2, 2022

Snowfakery is the more modern command and highly performant/scalable.

generate_and_load_from_yaml is simpler and slower at scale, but occasionally more reliable/understandable in weird situations for those same reasons.

This is admittedly a bit of a mess and I will endeavour to improve the reliability/understandability of the snowfakery task until the old one is never needed anymore. The old one may also be faster for small datasets.

@jorgesolebur
Copy link
Author

Great, thanks for the input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants