aura-helper-sfdx

Aura Helper CLI aplication Tools converted into SFDX Plugin

Usage no npm install needed!

<script type="module">
  import auraHelperSfdx from 'https://cdn.skypack.dev/aura-helper-sfdx';
</script>

README

Aura Helper SFDX

Version CircleCI Appveyor CI Greenkeeper Known Vulnerabilities Downloads/week License

SFDX Plugin to work with Salesforce Projects. This application are entire developed using Aura Helper Framework and has powerfull commands to manage your projects, create Continous Integration and DevOps workflows and support developers to make some utils task on every project like import and export data, create package files (including from git differences), compare metadata from two orgs or from your local project and the auth org, and to much more. It is the Aura Helper CLI natural evolution to integrate better to other salesforce tools.

Features

  • Simplify your work with Salesforce and Git with the command for create packages (for deploy and delete) from git changes. Compare two branches, commits or tags for create the files for deploy your package.
  • Repair file dependencies errors on your project files or Check only to resolve errors manually.
  • Compress your XML Files structure for make easy identify changes and resolve git conflicts. Also need less storage and work faster.
  • Retrieve special Metadata Types like profiles or permissions sets (and others) with all data without retrieve any file more with a simple command. Also can Retrieve special Metadata Types from the connected org.
  • Compare your local data with your authorized organization for get the differences for delete, retrieve or anything you want. Or Compare the Metadata Types between two orgs to see the differences.
  • Merge diferent package or destructive files into one file with only one command.
  • Ignore any metadata type from your local project or from the package files for maintance different configuration into your sandbox and production enviroments with simple file and command.
  • Specially designed for DevOps workflows.
  • And much more

Specially Designed for DevOps Workflows



Supported Operative Systems:

  • Windows
  • Linux
  • Mac OS X

Table of Contents


Installation Guide

You can install the plugins using SFDX plugins manager or cloning the repository and link it with sfdx.

SFDX Plugins manager (Recommended)

To install Aura Helper SFDX run the next command:

sfdx plugins:install aura-helper-sfdx

NPM Installation

To install Aura Helper SFDX run the next command:

npm install -g aura-helper-sfdx

Clone Repository Installation

To install cloning the source code repository, follow the next steps

  1. Clone the repository

  2. Go to the root project folder

  3. Run the next command

     sfdx plugins:link
    

Aura Helper SFDX Commands

All commands from Aura Helper SFDX have the next structure:

sfdx <command:name> [command:input] [options]

Al commands start by ah. For example

sfdx ah:topic:command [command:input] [options]

Commands Group

Aura Helper SFDX has little bit different commands organizations. To make it more usefull and easy to use, all options to create packages files using Aura Helper has its own topics to organize it better. Now has specific commands to create packages from git, json file or merge package files.


Help

If you need help with Aura Helper SFDX, you can run:

sfdx help ah

or

sfdx help ah:topic

or

sfdx help ah:command

or

sfdx help ah:topic:command

Metadata Commands

Metadata commands are the commands for work with your metadata files. You can compress xml files, list or describe metadata types that you have on your org or in your local project. Can compare local and org metadata or ignore some metadata types according .ahignore.json file (see Ignore File section). Also you can repair project metadata dependencies and much more. These commands are bellow two big groups. Local and Org commands. The Local commands work only with the metadata types that you have in your local project. The Org commands are commands for work with the data in your auth org.

Local Metadata Commands

  • ah:metadata:local:compress

    Command for compress XML files for ocuppy less data storage, and make more usefull with SVC systems like Git. With XML Files compressed, the file confilcts on merges are to much easy to resolve.

  • ah:metadata:local:ignore

    Command for ignore some metadata types. If you use git or other SVC systems, you can construct a .gitignore file or similar for ignore some files from your SVC. But salesforce have some metadata that can't be ignored with git because have into other files, like custom labels, workflows or user permissios for example. This command allow to you to ignore this types of metadata. This command support all metadata types to ignore. (Can delete entire files and folders)

  • ah:metadata:local:list

    Command to describe all or specific Metadata Types like Custom Objects, Custom Fields, Apex Classes... that you have in your local project.

  • ah:metadata:local:describe

    Command to describe all or specific Metadata Types like Custom Objects, Custom Fields, Apex Classes... that you have in your local project.

  • ah:metadata:local:repair

    Command to Check or Repair dependencies errors on your local project. (Only check data and types stored in your local project, do not connect to the org)

  • ah:metadata:local:special:retrieve

    Command for retrieve the special metadata types stored in your local project. The special types are the types generated at runtime when retrieving data from org according the package data. Files like permission sets, profiles or translations. For example, with this command you can retrieve all permissions from a profile without retrieve anything more. Also you can retrieve only the Custom Object XML Files without retrieve anything more.


ah:metadata:local:compress

Command for compress XML files for ocuppy less data storage, and make more usefull with SVC systems like Git. With XML Files compressed, the file confilcts on merges are to much easy to resolve.

Usage:

sfdx ah:metadata:local:compress [-r <filepath>] [-s simpleFirst|complexFirst|alphabetAsc|alphabetDesc] [-a | -d <array> | -f <array>] [-p] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder. 
    -a | --all                                                          Compress all XML files with support compression in your project.
    -d | --directory <path/to/directory>[,<path/to/directory>...]       Compress XML Files from specific directory or directories separated by commas.  
                                                                        This options does not take effect if you 
                                                                        choose compress all.
    -f | --file <path/to/file> [, <path/to/file>...]                    Compress the specified XML file or files separated by commas. This options does not take effect if you                                                                 choose compress directory or all.
    [-s | --sort-order <sortOrder>]                                     Sort order for the XML elements when compress XML files. By default, the elements are sorted with 
                                                                        simple XML elements first. Values: simpleFirst, complexFirst, alphabetAsc, alphabetDesc
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
        "message": "Compress XML files finish successfully",
        "totalFiles": 0,    // Total files processed
        "compressed": 0,    // Total files compressed
        "failed": 0         // Total files failed
      }
    }

Examples:

Compress All XML metadata files on your salesforce project:

sfdx ah:metadata:local:compress -a

Compress All XML Files for objects folder (and subfolders) with json response:

sfdx ah:metadata:local:compress -d force-app/main/default/objects --json

Compress Account XML File with progress report:

sfdx ah:metadata:local:compress -f force-app/main/default/objects/Account/Account.object-meta-xml -p

Compress objects folder (and subfolders) and applications folder

sfdx ah:metadata:local:compress -d force-app/main/default/objects, force-app/main/default/applications

Compress Account and Case object file with json response:

sfdx ah:metadata:local:compress -f force-app/main/default/objects/Account/Account.object-meta-xml, force-app/main/default/objects/Case/Case.object-meta-xml --json

ah:metadata:local:ignore

Command for ignore some metadata types. If you use git or other SVC systems, you can construct a .gitignore file or similar for ignore some files from your SVC. But salesforce have some metadata that can't be ignored with git because have into other files, like custom labels, workflows or user permissios for example. This command allow to you to ignore this types of metadata. This command support all metadata types to ignore. (Can delete entire files and folders)

Usage:

sfdx ah:metadata:local:ignore [-r <filepath>] [-s simpleFirst|complexFirst|alphabetAsc|alphabetDesc] [-a | -t <array>] [-i <filepath>] [-c] [-p] [--json] [--loglevel  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    -a | --all                                                          Ignore all metadata types according to the ignore file.
    -t | --type <MetadataTypeName>[,<MetadataTypeName>...]              Ignore the specified metadata types according to the ignore file. You can select a sigle or a list 
                                                                        separated by commas.
    [-i | --ignore-file <path/to/ignore/file>]                          Path to the ignore file. Use this if you not want to use the project root ignore file or have 
                                                                        different name. By default use .ahignore.json file from your project root.
    [-c | --compress]                                                   Add this option for compress modified files for ignore operation.
    [-s | --sort-order <sortOrder>]                                     Sort order for the XML elements when compress XML files. By default, the elements are sorted with 
                                                                        simple XML elements first. Values: simpleFirst, complexFirst, alphabetAsc, alphabetDesc
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
        "message": "Ignore metadata finished successfully",
      }
    }

Examples:

Ignore All metadata types specified in .ahignore.json file with progress report, colors and compressing files with JSON response

sfdx ah:metadata:local:ignore -a --json

Ignore only Custom Application, Custom Labels and Profiles specified in .ahignore.json file with another .ahignore.json with progress report

sfdx ah:metadata:local:ignore -t "CustomApplication, Profile, CustomLabels" -i "Path/to/the/file/.myignoreFile.json" -p

ah:metadata:local:list

Command for list all Metadata Types stored in your local project.

Usage:

sfdx ah:metadata:local:list [-r <filepath>] [--outputfile <filepath>] [--csv] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--output-file <path/to/output/file>]                               Path to file for redirect the output.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
        [
            {
                "xmlName": "APIName",
                "directoryName": "directoryName",
                "suffix": "fileSuffix",
                "inFolder": false,
                "metaFile": false,
            },
            {
                "xmlName": "APIName",
                "directoryName": "directoryName",
                "suffix": "fileSuffix",
                "inFolder": false,
                "metaFile": false,
            },
            {
                // More data...
            },
        ]
      }
    }

Examples:

List all types with progress an table result (default)

sfdx ah:metadata:local:list -p

List all types with csv result

sfdx ah:metadata:local:list --csv

List all types from different project and save the output into a file and json result

sfdx ah:metadata:local:list -r "path/to/other/project/root" --outputfile "path/to/the/output/file.txt" --json

ah:metadata:local:describe

Command to describe all or specific Metadata Types like Custom Objects, Custom Fields, Apex Classes... that you have in your local project.

Usage:

sfdx ah:metadata:local:describe [-r <filepath>] [-a | -t <array>] [--outputfile <filepath>] [--csv] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    -a | --all                                                          Describe all metadata types stored in your local project
    -t | --type <MetadataTypeName>[,<MetadataTypeName>...]              Describe the specified metadata types. You can select a single metadata or a list separated by commas. 
                                                                        This option does not take effect if you choose describe all.
    [-g | --group]                                                      Option to group global Quick Actions into GlobalActions group, false to list as object and item
    [--outputfile <path/to/output/file>]                               Path to file for redirect the output.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

See Metadata JSON Format section to learn about Metadata JSON Object returned by Aura Helper

    {
      "status": 0,
      "result": {
        // Metadata JSON Object
      }
    }

Examples:

Describe all metadata types stored in your local project with progress report and save the response into a file and csv response

sfdx ah:metadata:local:describe -a -p plaintext -s "path/to/the/output/file.txt" --csv

Describe Custom Objects, Custom Fields, Profiles and ValidationRules with progress report and show results as table (by default)

sfdx ah:metadata:local:describe -t "CustomObject, CustomField, Profile, ValidatiionRule" -p   

Describe Custom Objects and Custom Fields with json response

sfdx ah:metadata:local:describe -t "CustomObject, CustomField" --json 

ah:metadata:local:repair

Command to Check or Repair dependencies errors on your local project. (Only check data and types stored in your local project, do not connect to the org)

Usage:

sfdx ah:metadata:local:repair [-a | -t <array>] [-o] [-c] [-s simpleFirst|complexFirst|alphabetAsc|alphabetDesc] [-u] [-i <filepath>] [--outputfile <filepath>] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [-a | --all]                                                        Check or Repair all supported metadata types. (Support up to API v53.0)
    [-t | --type <MetadataType>[,<Type:Object>,<Type:Object:Item>...]]  Check or Repair specified metadata types. You can choose single type or a list separated by commas, also 
                                                                        you can choose to repair a specified objects like "MetadataTypeAPIName:MetadataObjectAPIName" or "MetadataTypeAPIName:ObjectAPIName:ItemAPIName". For example, "CustomApplication:AppName1" for repair only AppName1 Custom App. This option does not take effet if select repair all.
    [-c | --compress]                                                   Add this option for compress modified files for ignore operation.
    [-s | --sort-order <sortOrder>]                                     Sort order for the XML elements when compress XML files. By default, the elements are sorted with 
                                                                        simple XML elements first. Values: simpleFirst, complexFirst, alphabetAsc, alphabetDesc
    
    [-u | -useignore]                                                   Option to ignore to check or repair the metadata included in ignore file
    [-i | --ignorefile]                                                 Path to the ignore file. Use this if you don't want to use the project root ignore file or has a 
                                                                        different name.
    [--output-file <path/to/output/file>]                               Path to file for redirect the output.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Repair Response:

See Dependencies Repair Response section to learn about Repair Response

    {
      "status": 0,
      "result": {
            "MetadataTypeName": {
                "metadataType": "MetadataTypeName"
                "errors": [
                    {
                        "file": "path/to/file"
                        "errors": [
                            {
                                "elementPath": "xmlSuperParentTag>xmlParentTag>xmlTag",
                                "value": "error value",
                                "metadataType": "error Metadata Type",
                                "metadataObject": "error Metadata Object",
                                "metadataItem": "error Metadata Item",
                                "xmlElement": {
                                    // xml Element error data
                                }
                            },
                            {
                                ...
                            },
                            {
                                ...
                            }
                        ]
                    },
                    {
                        ...
                    },
                    {
                        ...
                    }
                ]
            }
        }
    }

JSON Check Response:

See Dependencies Check Response section to learn about Repair Response

    {
      "status": 0,
      "result": {
            "MetadataTypeName": [
                {
                    "object": "MetadataObject",
                    "item": "MetadataItem",
                    "line": 16,
                    "startColumn": 146,
                    "endColumn": 166,
                    "message": "MetadataTypeName named MetadataObject.MetadataItem does not exists",
                    "severity": "Warning",
                    "file": "/path/to/file"
                },
                {
                    "object": "MetadataObject",
                    "item": "MetadataItem",
                    "line": 17,
                    "startColumn": 146,
                    "endColumn": 166,
                    "message": "MetadataTypeName named MetadataObject.MetadataItem does not exists",
                    "severity": "Warning",
                    "file": "/path/to/file"
                },
            ],
            "MetadataTypeName": [
                {
                    ...
                },
                {
                    ...
                }
            ]
        }
    }

Examples:

Repair all supported types and compress repaired files

sfdx ah:metadata:local:repair -a -c

Repair Custom Aplication named App1, All profiles, Two permission sets Perm1 and Perm2 and one Custom Field

sfdx ah:metadata:local:repair -t "CustomApplication:App1,Profile,PermissionSet:Perm1,PermissionSet:Perm2,CustomField:Account:Custom_field__c"

Check only the errors on profiles and save the output on a file

sfdx ah:metadata:local:repair -t "Profile" -o ""path/to/the/output/errors.txt""

ah:metadata:local:special:retrieve

Command for retrieve the special metadata types stored in your local project. The special types are the types generated at runtime when retrieving data from org according the package data. Files like permission sets, profiles or translations. For example, with this command you can retrieve all permissions from a profile without retrieve anything more. Also you can retrieve only the Custom Object XML Files without retrieve anything more.

Usage:

sfdx ah:metadata:local:special:retrieve [-r <filepath>] [-a | -t <array>] [-i] [--downloadall] [-c] [-s simpleFirst|complexFirst|alphabetAsc|alphabetDesc] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [-a | --all]                                                        Retrieve all supported metadata types (Profile,PermissionSet,Translations,RecordType,CustomObject)
    [-t | --type <MetadataType>[,<Type:Object>,<Type:Object:Item>...]]  Retrieve specifics metadata types. You can choose one or a comma separated list of elements. Also you can 
                                                                        choose retrieve a specific profile, object o record type. Schema -> "Type1" or "Type1,Type2" or "Type1:Object1, Type1:Object2" or "Type1:Object1:Item1" for example:  "Profile, PermissinSet" to retrieve all profiles and permission sets. "Profile:Admin" to retrieve the admin profile. "RecordType:Account:RecordType1" to retrieve the RecordType1 for the object Account or "RecordType:Account" to retrieve all Record Types for Account
    [-i | --includeorg]                                                 With this option, you can retrieve the data from org and not only for local, but only retrieve the types 
                                                                        that you have in your local.
    [--downloadall]                                                     Option to download all Metadata Types from any Namespaces (including managed packages). If this options is 
                                                                        not selected, only download and retrieve data from your org namespace
    [-c | --compress]                                                   Add this option for compress modified files for ignore operation.
    [-s | --sort-order <sortOrder>]                                     Sort order for the XML elements when compress XML files. By default, the elements are sorted with 
                                                                        simple XML elements first. Values: simpleFirst, complexFirst, alphabetAsc, alphabetDesc
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
            "id": "RetrieveId",
            "status": "RetrieveStatus",
            "done": true,   
            "success": true,
            "inboundFiles": [
                {
                    "fullName": "fileFullName",
                    "state": "fileState",
                    "type": "MetadataType",
                    "filePath": "path/to/retrieved/file",
                },
                {
                    ...
                }
            ],
            "packages": [
                {
                    "name": "packageName",
                },
                {
                    ...
                }
            ],
            "warnings": [
                {
                    "fileName": "fileNameValue",
                    "problem": "problemDescription",
                },
                {
                    ...
                }
            ],
        }
    }

Examples:

Retrieve all supported types only including org data and only org namespace data, progress report and file compression

sfdx ah:metadata:local:special:retrieve -a -c -i -o

Retrieve All Profiles, Perm1 and Perm2 Permission Sets, all Case RecordTypes and RtName Account Recordtype with colorized output and progress report

sfdx ah:metadata:local:special:retrieve -t "Profile, PermissionSet:Perm1, PermissionSet:Perm2, RecordType:Case, RecordType:Account:RtName"

Org Metadata Commands

  • metadata:org:list

    Command for list all Metadata Types stored in your auth org

  • metadata:org:describe

    Command to describe all or specific Metadata Types likes Custom Objects, Custom Fields, Apex Classes... that you have in your auth org

  • ah:metadata:org:compare

    Command for compare your local project with your auth org for get the differences. The result are the metadata types and objects that you have in your org, but don't have in your local project.

  • ah:metadata:org:between:compare

    Command to compare two organization to get the differences. Return the metadata that exists on target but not exists on source

  • metadata:org:special:retrieve

    Command to retrieve the special metadata types stored in your auth org. The special types are all types generated at runtime when retrieving metadata according the package data. Files like permission sets, profiles or translations. For example, with this command you can retrieve all permissions from a profile without retrieve anything more. Also you can retrieve only the Custom Object XML Files without retrieve anything more.

  • ah:metadata:org:permissions:get

    Command to get all available User permisions in your org.

  • ah:metadata:org:apex:execute

    Command to execute an Anonymous Apex script from file against the auth org N times.


ah:metadata:org:list

Command for list all Metadata Types stored in your local project.

Usage:

sfdx ah:metadata:local:list [-r <filepath>] [--outputfile <filepath>] [--csv] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--output-file <path/to/output/file>]                               Path to file for redirect the output.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
        [
            {
                "xmlName": "APIName",
                "directoryName": "directoryName",
                "suffix": "fileSuffix",
                "inFolder": false,
                "metaFile": false,
            },
            {
                "xmlName": "APIName",
                "directoryName": "directoryName",
                "suffix": "fileSuffix",
                "inFolder": false,
                "metaFile": false,
            },
            {
                // More data...
            },
        ]
      }
    }

Examples:

List all types with progress an table result (default)

sfdx ah:metadata:org:list -p

List all types with csv result

sfdx ah:metadata:org:list --csv

List all types from different project and save the output into a file and json result

sfdx ah:metadata:org:list -r "path/to/other/project/root" --outputfile "path/to/the/output/file.txt" --json

ah:metadata:org:describe

Command to describe all or specific Metadata Types likes Custom Objects, Custom Fields, Apex Classes... that you have in your auth org

Usage:

sfdx ah:metadata:org:describe [-r <filepath>] [-a | -t <array>] [--group] [--downloadall] [--outputfile <filepath>] [--csv] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    -a | --all                                                          Describe all metadata types
    -t | --type <MetadataTypeName>[,<MetadataTypeName>...]              Describe the specified metadata types. You can select a single metadata or a list separated by commas. 
                                                                        This option does not take effect if you choose describe all.
    [-g | --group]                                                      Option to group global Quick Actions into GlobalActions group, false to list as object and item
    [--downloadall]                                                     Option to download all Metadata Types from any Namespaces (including managed packages). If this options is 
                                                                        not selected, only download data from your org namespace
    [--output-file <path/to/output/file>]                               Path to file for redirect the output.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

See Metadata JSON Format section to learn about Metadata JSON Object returned by Aura Helper

    {
      "status": 0,
      "result": {
        // Metadata JSON Object
      }
    }

Examples:

Describe all metadata types stored in your local project with progress report and save the response into a file and csv response

sfdx ah:metadata:local:describe -a -p plaintext -s "path/to/the/output/file.txt" --csv

Describe Custom Objects, Custom Fields, Profiles and ValidationRules with progress report and show results as table (by default)

sfdx ah:metadata:local:describe -t "CustomObject, CustomField, Profile, ValidatiionRule" -p   

Describe Custom Objects and Custom Fields with json response

sfdx ah:metadata:local:describe -t "CustomObject, CustomField" --json 

ah:metadata:org:compare

Command for compare your local project with your auth org for get the differences. The result are the metadata types and objects that you have in your org, but don't have in your local project.

Usage:

sfdx ah:metadata:org:compare [-r <filepath>] [--outputfile <filepath>] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

See Metadata JSON Format section to learn about Metadata JSON Object returned by Aura Helper

    {
      "status": 0,
      "result": {
        // Metadata JSON Object
      }
    }

Examples:

Compare the local and org data with json result

aura-helper metadata:org:compare --json

Compare the local and org data with csv result

aura-helper metadata:org:compare --csv

Compare the local and org data with table result

aura-helper metadata:org:compare

ah:metadata:org:between:compare

Command to compare two organization to get the differences. Return the metadata that exists on target but not exists on source

Usage:

sfdx ah:metadata:org:between:compare -t <string> [-r <filepath>] [-s <string>] [--outputfile <filepath>] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-s | --source]                                                     Source Salesforce org to compare. If you want to compare your active org with other, this options is not 
                                                                        necessary because use the --root option for get the project's auth org. If you choose source, --root will be ignored
    [-t | --target]                                                     Target Salesforce org to compare
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a spinner loader
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

See Metadata JSON Format section to learn about Metadata JSON Object returned by Aura Helper

    {
      "status": 0,
      "result": {
        // Metadata JSON Object
      }
    }

Examples:

Compare project org with another

sfdx ah:metadata:org:between:compare -t test.username@salesforceOrg.com.qa

Compare between to orgs

sfdx ah:metadata:org:between:compare -s test.username@salesforceOrg.com.uat -t test.username@salesforceOrg.com.qa

ah:metadata:org:special:retrieve

Command to retrieve the special metadata types stored in your auth org. The special types are all types generated at runtime when retrieving metadata according the package data. Files like permission sets, profiles or translations. For example, with this command you can retrieve all permissions from a profile without retrieve anything more. Also you can retrieve only the Custom Object XML Files without retrieve anything more.

Usage:

sfdx ah:metadata:org:special:retrieve [-r <filepath>] [-a | -t <array>] [--downloadall] [-c] [-s simpleFirst|complexFirst|alphabetAsc|alphabetDesc] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [-a | --all]                                                        Retrieve all supported metadata types (Profile,PermissionSet,Translations,RecordType,CustomObject)
    [-t | --type <MetadataType>[,<Type:Object>,<Type:Object:Item>...]]  Retrieve specifics metadata types. You can choose one or a comma separated list of elements. Also you can 
                                                                        choose retrieve a specific profile, object o record type. Schema -> "Type1" or "Type1,Type2" or "Type1:Object1, Type1:Object2" or "Type1:Object1:Item1" for example:  "Profile, PermissinSet" to retrieve all profiles and permission sets. "Profile:Admin" to retrieve the admin profile. "RecordType:Account:RecordType1" to retrieve the RecordType1 for the object Account or "RecordType:Account" to retrieve all Record Types for Account
    [--downloadall]                                                     Option to download all Metadata Types from any Namespaces (including managed packages). If this options is 
                                                                        not selected, only download and retrieve data from your org namespace
    [-c | --compress]                                                   Add this option for compress modified files for ignore operation.
    [-s | --sort-order <sortOrder>]                                     Sort order for the XML elements when compress XML files. By default, the elements are sorted with 
                                                                        simple XML elements first. Values: simpleFirst, complexFirst, alphabetAsc, alphabetDesc
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a 
                                                                        spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
            "id": "RetrieveId",
            "status": "RetrieveStatus",
            "done": true,   
            "success": true,
            "inboundFiles": [
                {
                    "fullName": "fileFullName",
                    "state": "fileState",
                    "type": "MetadataType",
                    "filePath": "path/to/retrieved/file",
                },
                {
                    ...
                }
            ],
            "packages": [
                {
                    "name": "packageName",
                },
                {
                    ...
                }
            ],
            "warnings": [
                {
                    "fileName": "fileNameValue",
                    "problem": "problemDescription",
                },
                {
                    ...
                }
            ],
        }
    }

Examples:

Retrieve all supported types with only org namespace data and file compression

sfdx ah:metadata:org:special:retrieve -a -c

Retrieve All Profiles, Perm1 and Perm2 Permission Sets, all Case RecordTypes and RtName Account Recordtype

sfdx ah:metadata:org:special:retrieve -t "Profile, PermissionSet:Perm1, PermissionSet:Perm2, RecordType:Case, RecordType:Account:RtName"

ah:metadata:org:permissions:get

Command to get all available User permisions in your org.

Usage:

sfdx ah:metadata:org:permissions:get [-r <filepath>] [--outputfile <filepath>] [--csv] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--output-file <path/to/output/file>]                               Path to file for redirect the output.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [--csv]                                                             Option to show the result as CSV instead a table if not select --json flag.
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
        "status": 0,
        "result": [
            "ActivateContract",
            "ActivateOrder",
            "ActivitiesAccess",
            "AddDirectMessageMembers",
            "AllowUniversalSearch",
            ...
        ]
    }

Examples:

Execute an script 3 times without printing log with colorized output and progress report

sfdx ah:metadata:org:apex:execute -f "path/to/script.apex" -i 3

Execute an script 10 times wit printing log, colorized output and progress report

sfdx ah:metadata:org:apex:execute -f "path/to/script.apex" --iterations 10 --printlog

ah:metadata:org:apex:execute

Command for retrieve the special metadata types stored in your local project. The special types are the types generated at runtime when retrieving data from org according the package data. Files like permission sets, profiles or translations. For example, with this command you can retrieve all permissions from a profile without retrieve anything more. Also you can retrieve only the Custom Object XML Files without retrieve anything more.

Usage:

sfdx ah:metadata:org:apex:execute (-f <filepath> | undefined | undefined) [-r <filepath>] [-i <number>] [-l] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    -f | --file                                                         Path to the Anonymous Apex Script file
    [-i | --iterations]                                                 Option to select the scritp execution number. For example, 3 for execute the script 3 times
    [-l | --printlog]                                                   Option to print the result log of every execution
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
        "status": 0,
        "result": {
            "message": "Apex execution finished succesfully"
        }
    }

Examples:

Execute an script 3 times without printing log with colorized output and progress report

sfdx ah:metadata:org:apex:execute -f "path/to/script.apex" -i 3

Execute an script 10 times wit printing log, colorized output and progress report

sfdx ah:metadata:org:apex:execute -f "path/to/script.apex" --iterations 10 --printlog

Package Commands

The Package commands are commands to create Package or Destructive XML files from different sources. You can create Package or Destructive XML files from git. Compare two branches, commits, tags... to create package files with git changes, or create package files usings a Metadata JSON Object (See Metadata JSON Format section to understand about it), or merge several Package or Destructive files into one file by type, all into only one file or other options to merge.

GIT

  • ah:​package:git:create

    Create a Package XML file and/or Destructive XML file from Git Changes to create a delta package to deploy and/or delete Metadata. Compare between two branches, commits or tags (even only your active branch) to create the files.

JSON

Merge

  • ah:​package:merge

    Create a Package XML file and/or Destructive XML file(s) from several package or destructive files.


ah:​package:git:create

Create a Package XML file and/or Destructive XML file from Git Changes to create a delta package to deploy and/or delete Metadata. Compare between two branches, commits or tags (even only your active branch) to create the files.

Usage:

sfdx ah:package:git:create [-r <filepath>] [--outputpath <filepath>] [-f package|p|destructive|d|both|b] [-b] [-s <string>] [-t <string>] [-r] [-u] [-i <filepath>] [--ignoredestructive] [--destructiveignorefile <filepath>] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--outputpath <target/files/path>]                                  Path to save the generated files. By default is your manifest folder
    [-f | --filetype] <fileTypeValue>                                   Option to select the generated file type(s). You can choose between package (p), destructive (d) or 
                                                                        both (b). Both by default.
    [-s | --source]                                                     Source branch, commit, tag... to compare changes and create delta files. That is the new code source 
                                                                        or the "source salesforce org to get changes". You can select only source to create files from active branch changes (If not select source, also get the active branch)
    [-t | --target]                                                     Target branch, commit, tag... to compare changes and create delta files. That is the old code source 
                                                                        or the "target salesforce org to deploy changes"
    [-b | --deletebefore]                                               Option to create the Descructive XML file to deploy it before package file (delete files before deploy 
                                                                        new changes insted delete files after deploy changes).
    [-u | -useignore]                                                   Option to ignore the metadata included in ignore file from the package
    [-i | --ignorefile]                                                 Path to the ignore file. Use this if you don't want to use the project root ignore file or has a 
                                                                        different name.
    [--ignoredestructive]                                               Option to ignore metadata from destructive changes created file
    [--destructiveignorefile]                                           Path to use different ignore file to ignore destructive changes instead the ignore file to ignore 
                                                                        changes to deploy
    [-r | --raw]                                                        Option to return the raw data instead create xml files. This option returns a JSON Object with the 
                                                                        extracted data from git changes. Only work with --json flag
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
        "package": "path/to/the/created/package/file",                          // undefined if file not created
        "destructiveChanges": "path/to/the/created/destructive/file",           // undefined if file not created
        "destructiveChangesPost": "path/to/the/created/destructive/post/file"   // undefined if file not created
      }
    }

JSON RAW Response:

See Metadata JSON Format section to understand about Metadata JSON Object returned by Aura Helper

    {
      "status": 0,
      "result": {
        "toDeploy": {
            // Metadata JSON Object with metadata to Deploy
        },
        "toDelete": {
            // Metadata JSON Object with metadata to Delete
        },
      }
    }

Examples:

Create both files with not commited changes on active branch (default behaviour without parameters)

sfdx ah:package:git:create

Create both files with changes between to the active branch and another branch.

sfdx ah:package:git:create -f both -t Develop --json

Create package file only with changes between two commits (the source commit must be the most recent commit from both)

sfdx ah:package:git:create -f package -s 1n3a5d3 -t 4a345da

Create destructive file only to delete metadata before deploy and raw response with changes between to tags (source must be the most recent tag from both) with:

sfdx ah:package:git:create -f destructive --deletebefore -s v2.0.0 -t v1.0.0 --raw --json

Create both files with changes between to branches, using ignore files to package and destructive files (using project ignore to package file).

sfdx ah:package:git:create -f both -s UAT -t main -u --ignoredestructive --destructiveignorefile "./.ahignoreDestructive.json" --json

ah:​package:json:create

Create a Package XML file or Destructive XML file from a JSON Metadata File

Usage:

sfdx ah:package:json:create -s <filepath> [-r <filepath>] [--outputpath <filepath>] [-d] [-b] [-u] [-i <filepath>] [-w] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--outputpath <target/files/path>]                                  Path to save the generated file. By default is your manifest folder
    -s | --source                                                       Metadata JSON file path to create the Package or Destructive file
    [-d | --todelete]                                                   Option to create the package to delete metadata (Destructive XML File).
    [-b | --deletebefore]                                               Option to create the Descructive XML file to deploy it before package file (delete files before deploy 
                                                                        new changes insted delete files after deploy changes).
    [-w | --wildcards]                                                  Option to use wildcards instead the explicit names when apply.
    [-u | -useignore]                                                   Option to ignore the metadata included in ignore file from the package
    [-i | --ignorefile]                                                 Path to the ignore file. Use this if you don't want to use the project root ignore file or has a 
                                                                        different name.
    [--apiversion <apiVersion>]                                         Override the api version used for api requests made by this command
    [-p | --progress]                                                   Option to report the command progress (into the selected format) or show a spinner loader
    [--json]                                                            Format output as JSON.
    [--loglevel <LOGLEVEL>]                                             The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.     
                                                                        Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default value: warn

JSON Response:

    {
      "status": 0,
      "result": {
        "package": "path/to/the/created/package/file",                          // undefined if file not created
        "destructiveChanges": "path/to/the/created/destructive/file",           // undefined if file not created
        "destructiveChangesPost": "path/to/the/created/destructive/post/file"   // undefined if file not created
      }
    }

Examples:

Create package XML file using data from JSON file

sfdx ah:package:json:create -s path/to/metadata/json/file.json

Create package XML file using data from JSON file and use project ignore file to ignore Metadata from package

sfdx ah:package:json:create -s path/to/metadata/json/file.json -u

Create destructive XML file using data from JSON file and use project ignore file to ignore Metadata from package

sfdx ah:package:json:create -s path/to/metadata/json/file.json --todelete -u

Create destructive XML file using data from JSON file to deploy before package XML file.

sfdx ah:package:json:create -s path/to/metadata/json/file.json --todelete --deletebefore

ah:​package:merge

Create a Package XML file and/or Destructive XML file(s) from several package or destructive files.

Usage:

sfdx ah:package:merge -s <array> [--outputpath <filepath>] [--bytype | --fullpackage | --fulldestructive | --onlypackage | --onlydestructive] [-b] [-u] [-i <filepath>  [--ignoredestructive] [--destructiveignorefile <filepath>] [-p] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Options:

    [-r | --root <path/to/project/root>]                                Path to project root. By default is your current folder.
    [--outputpath <target/files/path>]                                  Path to save th