1

I run a tests in GitLab PipeLine

sfdx force:apex:test:run --wait 10 --resultformat human --codecoverage --testlevel RunLocalTests

and get error

System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, portal account owner must have a role: []

If I understand correctly, an additional parameter is needed when creating a scratch org. Thanks to everyone who answers.

0

1 Answer 1

2

When you create a Scratch Org, it is pre-populated with OOTB Roles. However, these Roles are broken and cannot be used. To allow certain types of test to execute successfully you need to make sure to assign a custom role to the "User User".

We did this using some scripting. You can use the sfdx CLI commands to achieve this. Since we were already using Ant we scripted that way. You can see further details in my answer in a previous question.

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