LaceySnr.com - Salesforce Development Posts by Matt Lacey

Moving Between Machines With DX

Posted: 2019-03-26

Like (I suspect) a lot of people, I don't just use one machine for my development work. I'm regularly moving between a laptop and my home desktop machine, and occasionally spend a few days at a time using my old Mac Book Pro. This kind of change was always a bit of an inconvenience with IDE setup etc. for development of any kind, not just Salesforce, but with the transition to DX and the source repository becoming the source of truth this nomadic development became even easier to deal with.

The only place where it fell short for me personally, was that my scratch orgs were tied to specfic machines. Sure  you should be able to fire up a scratch org for a day and pull your changes out, but some of our features require quite a bit of configuration and integration to other systems, and duplicating this effort can waste a fair amount of time. I'd thought about only doing my work in dropbox folders etc. but it felt like it'd be a good way to make a mess of things, so I held off.

This week I finally got around to searching for a solution again, and found a post on the Salesforce Stack Exchange that received a working answer over a year ago, somehow it had zero votes when I found it, and yet there was nothing else that showed readily in my search results. What's most strange of all is that it's actually pretty obvious when you think about, and despite hooking DX up to different orgs on a reasonably regular basis to use sfdx:force:source:retreive/deploy, doing this with a scratch org just hadn't occured to me. Maybe there's no other search results because everybody's just doing this and thought it was immediately obvious, but I'm writing this here in the hope that it helps somebody else who failed to see the wood for the trees.

Go thank this man, please!

So, courtesy of Steals, you can find the solution right here (I would post the relevant info, but he deserves your up-votes people!). While I'm at it, please go and vote in the moderator election too!