Snowfakery icon indicating copy to clipboard operation
Snowfakery copied to clipboard

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

Open jorgesolebur opened this issue 3 years ago • 5 comments

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 avatar Apr 28 '22 07:04 jorgesolebur

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.

jorgesolebur avatar Apr 28 '22 07:04 jorgesolebur

I believe this is a bug but I also think you can work around it by specifying -o drop_missing_schema True. That worked for me.

On Thu, Apr 28, 2022 at 12:29 AM Jorge @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/SFDO-Tooling/Snowfakery/issues/648#issuecomment-1111845199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFMSZKGVYNVSKD5TDEOILVHI46PANCNFSM5URNQ3KA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

prescod avatar Apr 29 '22 10:04 prescod

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 !

jorgesolebur avatar May 02 '22 08:05 jorgesolebur

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.

prescod avatar May 02 '22 20:05 prescod

Great, thanks for the input

jorgesolebur avatar May 05 '22 08:05 jorgesolebur