@salesforce/plugin-apex
Apex commands
Last updated 6 days ago by jgrantham .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @salesforce/plugin-apex 
SYNC missed versions from official npm registry.

salesforcedx-apex

Apex commands

Version CircleCI Appveyor CI Codecov Greenkeeper Known Vulnerabilities Downloads/week License

$ npm install -g @salesforce/plugin-apex
$ sfdx COMMAND
running command...
$ sfdx (-v|--version|version)
@salesforce/plugin-apex/0.0.12 darwin-x64 node-v12.4.0
$ sfdx --help [COMMAND]
USAGE
  $ sfdx COMMAND
...

sfdx force:apex:execute [-f <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

executes anonymous Apex code

USAGE
  $ sfdx force:apex:execute [-f <filepath>] [-u <string>] [--apiversion <string>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -f, --apexcodefile=apexcodefile                                                   path to a local file that contains
                                                                                    Apex code

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Executes one or more lines of anonymous Apex code entered on the command line, or executes the code in a local file.
  If you don’t run this command from within a Salesforce DX project, —-targetusername is required.
  To execute your code interactively, run this command with no parameters. At the prompt, enter all your Apex code; 
  press CTRL-D when you're finished. Your code is then executed in a single execute anonymous request.
  For more information, see "Anonymous Blocks" in the Apex Developer Guide.

EXAMPLES
  $ sfdx force:apex:execute -u testusername@salesforce.org -f ~/test.apex
  $ sfdx force:apex:execute -f ~/test.apex
  $ sfdx force:apex:execute 
  Start typing Apex code. Press the Enter key after each line, then press CTRL+D when finished.

See code: src/commands/force/apex/execute.ts

sfdx force:apex:log:get [-i <id>] [-n <number>] [-d <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

fetch debug logs

USAGE
  $ sfdx force:apex:log:get [-i <id>] [-n <number>] [-d <string>] [-u <string>] [--apiversion <string>] [--json] 
  [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --outputdir=outputdir                                                         directory for saving the log files
  -i, --logid=logid                                                                 id of the log to display

  -n, --number=number                                                               number of most recent logs to
                                                                                    display

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as JSON

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Fetches the specified log or given number of most recent logs from the scratch org. 
  To get the IDs for your debug logs, run "sfdx force:apex:log:list". 
  Use the --logid parameter to return a specific log. 
  Use the --number parameter to return the specified number of recent logs.
  Use the --outputdir parameter to specify the directory to store the logs in.
  Executing this command without parameters returns the most recent log.

EXAMPLES
  $ sfdx force:apex:log:get -i <log id>
  $ sfdx force:apex:log:get -i <log id> -u me@my.org
  $ sfdx force:apex:log:get -n 2 -c
  $ sfdx force:apex:log:get -d Users/Desktop/logs -n 2

See code: src/commands/force/apex/log/get.ts

Debugging your plugin

We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the .vscode directory of this plugin is a launch.json config file, which allows you to attach a debugger to the node process when running your commands.

To debug the hello:org command:

  1. Start the inspector

If you linked your plugin to the sfdx cli, call your command with the dev-suspend switch:

$ sfdx hello:org -u myOrg@example.com --dev-suspend

Alternatively, to call your command using the bin/run script, set the NODE_OPTIONS environment variable to --inspect-brk when starting the debugger:

$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
  1. Set some breakpoints in your command code
  2. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
  3. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
  4. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
  5. Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).

    Congrats, you are debugging!

Current Tags

  • 0.1.2                                ...           latest (6 days ago)

8 Versions

  • 0.1.2                                ...           6 days ago
  • 0.1.1                                ...           25 days ago
  • 0.1.0                                ...           a month ago
  • 0.0.13                                ...           a month ago
  • 0.0.10                                ...           2 months ago
  • 0.0.9                                ...           2 months ago
  • 0.0.8                                ...           2 months ago
  • 0.0.7                                ...           2 months ago

Copyright 2014 - 2016 © taobao.org |