Skip to main content
Enhancing code snippets
Source Link
Brian Miller
  • 5.3k
  • 4
  • 38
  • 69

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg -w 3 
  1. CheckIf the deployment takes longer than three minutes (as specified in the above -w 3 flag), then check your deployment status in the production org itself or via mdapi:deploy:report:
sfdx force:mdapi:deploy:report -u MyProductionOrg 

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg -w 3 
  1. If the deployment takes longer than three minutes (as specified in the above -w 3 flag), then check your deployment status in the production org itself or via:
sfdx force:mdapi:deploy:report -u MyProductionOrg 

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

bolding the main point of the answer
Source Link
Brian Miller
  • 5.3k
  • 4
  • 38
  • 69

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to productionA nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

deploy "to production" added
Source Link
Brian Miller
  • 5.3k
  • 4
  • 38
  • 69

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

The "SFDX: Deploy Code to org" command uses the sfdx force:source:deploy command, which according to the documentation only deploys to non-production orgs (at least as of Spring '19).

A nifty way to deploy to production with these new commands (as inspired by the documentation above) is as follows:

  1. Set the SFDX_MDAPI_TEMP_DIR environment variable to a place that's easily accessible (like the metadata folder within your current project):
SFDX_MDAPI_TEMP_DIR=/path/to/mydxproject/metadata 
  1. Retrieve the exact metadata you want to deploy to production, like as follows:
sfdx force:source:retrieve -m ApexClass:MyUtilClass,ApexClass:MyUtilClass_Test -u MySandboxOrg 
  1. This will create a folder within your metadata folder with the metadata .zip file or package.xml file that you're looking for. Deploy from the zip file as follows (and feel free to add any other helpful options as specified in the mdapi Commands):
sfdx force:mdapi:deploy -f ./metadata/sdx_sourceRetrieve_1554058974901/unpackaged.zip -u MyProductionOrg 
  1. Check your deployment status in the production org itself or via mdapi:deploy:report

This allows you to use the new force:source:retrieve command and have it auto-convert into metadata, without having to call force:source:convert manually

making sfdx command more explicit
Source Link
Brian Miller
  • 5.3k
  • 4
  • 38
  • 69
Loading
Source Link
Brian Miller
  • 5.3k
  • 4
  • 38
  • 69
Loading