project convert mdapi
Convert metadata retrieved via Metadata API into the source format used in Salesforce DX projects.
To use Salesforce CLI to work with components that you retrieved via Metadata API, first convert your files from the metadata format to the source format using this command.
To convert files from the source format back to the metadata format, run “sf project convert source”.
To convert multiple metadata components, either set multiple –metadata <name> flags or a single –metadata flag with multiple names separated by spaces. Enclose names that contain spaces in one set of double quotes. The same syntax applies to –source-dir.
force:mdapi:convert
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑api‑version | N/A | Type: Value Override the api version used for api requests made by this command |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑manifest | ‑x | Type: Value File path to manifest (package.xml) of metadata types to convert. If you specify this flag, don’t specify –metadata or –source-dir. |
‑‑metadata | ‑m | Type: Value Metadata component names to convert. |
‑‑metadata‑dir | ‑p | Type: Value Root of directory or zip file of metadata formatted files to convert. The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its sub-directories). If you specify this flag, don’t specify –manifest or –metadata. If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes. |
‑‑output‑dir | ‑d | Type: Value Directory to store your files in after they’re converted to source format; can be an absolute or relative path. |
‑‑root‑dir | ‑r | Type: Value Required Root directory that contains the Metadata API–formatted metadata. |
Convert metadata formatted files in the specified directory into source formatted files; writes converted files to your default package directory:
Similar to previous example, but writes converted files to the specified output directory: