3

In sfdx guide there is a chapter named "Create, Clone, or Delete a Sandbox" (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_create_clone_sandboxes.htm).

But the problem we are facing now is how to refresh existent sandbox using sfdx cli.

It seems like there is no sfdx cli command/option to handle this, which is weird.

Are we missing something? If not, how then to trigger sandbox refresh in automatic way from CI/CD?

Any help would be appreciated.

2 Answers 2

1

There isn't a command for it, as you noted. There was a feature request for this in 2019 and it was mentioned as a limitation back in Summer '20 and that it was on the roadmap. However, it is still not available (and unclear if it is still on the roadmap). You can see all the available org commands and none include a refresh option.

As of Summer ‘20, the CLI sandbox refresh command is still on our roadmap, so you’ll need to use clicks in the production org or the Tooling API for now. If you’re interested in the API option, it turns out that we recently shared a Salesforce API collection for Postman that lets you run a sandbox refresh request with a few clicks.

You could look to leverage the Tooling API as it notes - but, I'll point out that there's a sfdx plugin, sfpowerkit, that does have a command to refresh sandboxes as well.

sfpowerkit:org:sandbox:refresh

1

Now It's possible to refresh a sandbox using the sf cli.

sf org refresh sandbox --name devSbx1 --target-org prodOrg

For more info please check this article.

You must log in to answer this question.

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