Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

force-dev-tool

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

force-dev-tool

Command line tool supporting the Force.com development and deployment workflow

  • 0.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
271
decreased by-37.27%
Maintainers
1
Weekly downloads
 
Created
Source

force-dev-tool

Command line tool supporting the Force.com development and deployment workflow

Build Status OS X / Linux

Build Status Windows Windows

Install

$ npm install --global force-dev-tool

Usage

$ force-dev-tool --help

Examples

Managing remote environments

$ force-dev-tool remote add mydev user pass --default
$ force-dev-tool remote add build user pass2
$ force-dev-tool remote add production user pass3 https://login.salesforce.com

Validating credentials for a given remote (optional)

$ force-dev-tool login mydev
Logged in successfully to remote mydev.
Use the following URL to open Salesforce in your web browser:

https://mynamespace.my.salesforce.com/secur/frontdoor.jsp?sid=REDACTED

Building a manifest

$ force-dev-tool fetch
Fetching from remote mydev
Created config/mydev-describe-metadata-result.json
Created config/mydev-manifest.json
Fetching remotes finished.
$ force-dev-tool package -a
Created src/package.xml

In order to exclude certain metadata components from being added to the manifest, add patterns (similar to .gitignore) to .forceignore.

Retrieving metadata

$ force-dev-tool retrieve
Retrieving from remote mydev to directory src
Succeeded

Creating deployments

1. By explicitly listing metadata files or metadata components

$ force-dev-tool changeset create vat src/pages/AccountExtensionVAT.page CustomField/Account.VAT__c

2. By providing a unified diff (e.g. git diff)

$ git diff master feature/vat | force-dev-tool changeset create vat

Both approaches lead to the following result

Manifest:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <types>
     <members>Account.VAT__c</members>
     <name>CustomField</name>
 </types>
 <types>
     <members>AccountExtensionVAT</members>
     <name>ApexPage</name>
 </types>
 <version>37.0</version>
</Package>

exported metadata container to config/deployments/vat

Creating destructive deployments (reverting changes)

1. By explicitly listing metadata files or metadata components

$ force-dev-tool changeset create undo-vat --destructive src/pages/AccountExtensionVAT.page CustomField/Account.VAT__c

2. By providing a unified diff (e.g. git diff)

$ git diff feature/vat master | force-dev-tool changeset create undo-vat

Both approaches lead to the following result

Manifest:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <version>37.0</version>
</Package>

Destructive Manifest:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <types>
     <members>Account.VAT__c</members>
     <name>CustomField</name>
 </types>
 <types>
     <members>AccountExtensionVAT</members>
     <name>ApexPage</name>
 </types>
</Package>

exported metadata container to config/deployments/undo-vat

Deploying metadata

$ force-dev-tool validate
$ force-dev-tool validateTest
$ force-dev-tool validateTest -d config/deployments/vat
$ force-dev-tool deploy
$ force-dev-tool deployTest

Options:

-d=<directory>    Directory containing the metadata and package.xml [default: ./src].

Running unit tests

$ force-dev-tool test

Note: Runs local unit tests using an empty deployment.

Using force-dev-tool in a build script

The following environment variables will be available as remote environment env:

  • SFDC_USERNAME
  • SFDC_PASSWORD
  • SFDC_SERVER_URL
$ force-dev-tool validateTest env

Executing a SOQL query

$ force-dev-tool query "SELECT Id, Name FROM Account LIMIT 1"
[
  {
    "attributes": {
      "type": "Account",
      "url": "/services/data/v37.0/sobjects/Account/001200000183ZCFAA2"
    },
    "Id": "001200000183ZCFAA2",
    "Name": "GenePoint"
  }
]

$ force-dev-tool query "SELECT COUNT(Id) c FROM Account"
[
  {
    "attributes": {
      "type": "AggregateResult"
    },
    "c": 15
  }
]

Exporting/importing data using the bulk API

Exporting data

$ force-dev-tool bulk export "SELECT Id, Name FROM Account LIMIT 1"
"Id","Name"
"001200000183ZCFAA2","GenePoint"
$ force-dev-tool bulk export "SELECT Id, Name FROM Account" --out Accounts.csv

Updating data

$ force-dev-tool bulk update Account --in Accounts.csv --out Accounts-update-results.csv

Executing anonymous Apex

$ echo "insert new Account(Name = 'Test Account');" | force-dev-tool execute

License

MIT © Matthias Rolke

Keywords

FAQs

Package last updated on 05 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc