+ Start a Discussion
Iago SilvaIago Silva 

Scratch org Id's pattern

I create a script to populate a scratch org with data from my production org, but the Id's of my scratch org doesn't match the type of my production/qa/developer org. 

For example, in production/developer org I have a custom object called Establishment__c and its ids starts with 'a15' and in my scratch org they start com 'a0z'. So if I try to create records in the scratch org with the same Id, I got an error: Invalid Id type for Establishment__c object.

Is there a way to create a scratch org with the same id pattern of my production/developer org?
SwethaSwetha (Salesforce Developers) 
HI Iago,
I see you also reached out on https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000DdFtVSAV according to which creating records based on hardcoded values is not recommended but
you can export the data from production using SFDX command with a plan for example 
sfdx force:data:tree:export --query="SELECT Id,Name,(SELECT Id,Firstname,LastName,AccountId from Contacts) from Account" --plan --outputdir .\sample-data\

Alternately, you can create a scratch org with the same features and settings as your production org with "Org Shape". More details: https://help.salesforce.com/s/articleView?id=sf.sfdx_dev_shape_enable_org_shape.htm&type=5

Let me know if you have follow up queries. If this information helps, please mark the answer as best. Thank you
Iago SilvaIago Silva
Hi Swetha, thanks for your response.
We ended up not using Org Shape because we faced some issues with this feature, maybe because is a beta feature.