Help us understand the problem. What is going on with this article?

Salesforce CLIでメタデータ取得(retrieve)

More than 1 year has passed since last update.

[概要]

本記事は、Salesforce CLIを使用してメタデータを取得する方法をまとめたものです。

[事前準備]

Salesforce CLIのインストールは下記を参照
https://developer.salesforce.com/docs/atlas.en-us.218.0.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm

[手順]

①対象組織のpackge.xmlを準備する

全てのメタデータを取得するのであれば
https://qiita.com/takahito0508/items/f5dac3ac214bc75142cf
で紹介されているツールが便利です。

②リリース対象の組織へログイン

sfdx force:auth:web:login -r <ログインURL> -a <別名を指定>

Sandboxの場合、ログインURLは"https://test.salesforce.com"

コマンドのオプションは以下を参照
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm

③接続できたかを確認

sfdx force:org:list

④メタデータを取得

sfdx force:mdapi:retrieve -s -r <出力ディレクトリ名> -k ./package.xml -u <別名もしくはUSERNAME>

~~
=== Result
Status: Succeeded
~~
と表示されれば完了

コマンドのオプションは以下を参照
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm

⑤zipを解凍

unzip unpackaged.zip

⑥ログアウト

sfdx force:auth:logout -u <別名もしくはUSERNAME>

[参考]

https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm

yhayashi30
このアカウントでの投稿は私個人の見解に基づくものです。
https://yhayashi30.org
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした