Push Queue and create its Users in scratch org

I am trying to create a fresh scratch org and push a source to it through a script. The problem comes with Queues (and probably other sources that reference usernames), they are associated with users which I need somehow import to that org. Sandboxes use the suffix of the org to find the username, which is something I am looking for in Scratch Org.

The only solution I thought would be to dynamically change usernames in the user import file (probably add timestamp after username) and replace the same usernames in all Queues. After the push, it would change back the usernames. This wouldn’t be hard to implement, but I still think it is something that could be possible in a standard way as in Sandboxes.

EDIT

Just found a section called “If Push Detects a Username Reference in the Source” in the documentation. It says that “the push command replaces the username with the scratch org’s administrator username”. I guess this should be what I am looking for, but still, my queue results in an error src/main/default/queues/Marina.queue-meta.xml In field: userName - no User named test-qwa3qfco1bwl@example.com found. The queue is the only file in my source. I tried both, real username from production and then my admin username from different scratch org. I am using sfdx version 7.11.2-4a5bf6aa97 and API version 45.0.

EDIT 2
Got an answer from support that this is a bug and will be resolved in one of the future releases.

Answer

Attribution
Source : Link , Question Author : ondrakr , Answer Author : Community

Leave a Comment