function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Topher ReynoldsTopher Reynolds 

CICD on GitLab with a scratch org... Is System Administrator profile in the scratch org?

I have setup the CICD on GitLab, we use the Org Development model. I keep getting the error below, after starting up a scratch org, when just trying to query the System Administrator profile. Does that exist in scratch orgs?
REQUIRED_FIELD_MISSING, Required fields are missing: [ProfileId]: [ProfileId] Class.HPC_TestDataFactory.createInvestorRelation: line 140, column 1...
In the method I am calling...
ProfileID=[SELECT Id FROM Profile WHERE name='System Administrator'].Id
VinayVinay (Salesforce Developers) 
Hi Topher,

The user’s profile is Standard User as per the below documentation.

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_users.htm

Can you try to clone and rename to system admin profile it should fix the issue.

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Topher ReynoldsTopher Reynolds
So I am spinning up the scratch org for CICD. How do I clone an account when I can't even log into the scratch org yet? Is there something that goes in the project-scratch-def.json to make this happen?
VinayVinay (Salesforce Developers) 
Try to use 'Standard User' profile.  Once you have this then try to clone them into custom profiles, and make the changes you want in there.

Note: Standard profiles can't be tinkered.

Thanks,
Topher ReynoldsTopher Reynolds
I do understand how to clone something when I am logged into an org. However, I am setting up CICD and I want this to be a hands off operation, since this is for CICD. Is there a way to do that programmatically? 
VinayVinay (Salesforce Developers) 
Scratch org has few limitations since these are temporary so setting up 'Standard User' should work.  

Thanks,