Skip to content

Plugin for Salesforce SFDX CLI to set explicit record types and roles into JSON data files for a scratch org

License

Notifications You must be signed in to change notification settings

billryoung/sfdx-wry-plugin

Repository files navigation

sfdx-wry-plugin

Utilities for SFDX JSON data files

Version Appveyor CI Codecov Known Vulnerabilities Downloads/week License

Install

sfdx plugins:install sfdx-wry-plugin

Docs

Allows you to use Record Type developer names in JSON files for sfdx's data:tree:import.

The intent is that you first run tool on your JSON data files. It creates a copy with scratch org specific ID values put in place. Then you run data:tree:import against that output copy.

Within your JSON files, Record Types can be referenced in one of two ways: First way, you can use a syntax of $R{RecordType.SobjectType.DeveloperName} such as $R{RecordType.Account.Vendor} This is a very concise way, good for adding in to pre-existing or manually maintained JSON data files.

Second way, in the data:tree:export command include "RecordType.DeveloperName" in the select fields along with other fields, such as "select Name, BillingState, RecordType.DeveloperName from Account". This leaves you with a very verbose RecordType reference in the JSON file, but one that this tool can recognize and replace.

Commands

sfdx wry:data:count

Counts rows in data objects

USAGE
  $ sfdx wry:data:count

OPTIONS
  -o, --objects=objects                           List of objects to check (CSV seperated for multiple) (defaults to
                                                  ALL)

  -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)  logging level for this command invocation

EXAMPLES
  $ sfdx wry:data:count --targetusername [email protected] -o Account,Opportunity,User
  Account: 14 records
  Account.Vendor: 2 records
  Account.Customer: 12 records
  Opportunity: 38 records
  User: 5 records
  
  $ sfdx wry:data:count -u [email protected] -o ALL
  Account: 14 records
  Account.Vendor: 2 records
  Account.Customer: 12 records
  Opportunity: 38 records
  User: 5 records

See code: src/commands/wry/data/count.ts

sfdx wry:file:replace

Replaces RecordType and UserRole references with Id values

USAGE
  $ sfdx wry:file:replace

OPTIONS
  -f, --force                                     Force overwrite output directory (not supported yet)
  -i, --inputdir=inputdir                         Directory containing JSON data files

  -o, --outputdir=outputdir                       Target directory for new versions of data files (default:
                                                  $inputdir.out)

  -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)  logging level for this command invocation

EXAMPLES
  $ sfdx wry:file:replace --targetusername [email protected] --inputdir dataFiles --outputdir dataFiles.replaced  

     Copying dataFiles/* to dataFiles.replaced/*
     Account.json: Replacing $R{RecordType.Account.Vendor} with 0125C000000IGVIQA4
     Account.json: Replacing $R{RecordType.Account.Customer} with 0125C000000IGVSQA4
     NewUser.json: Replacing $R{UserRole.CEO} with 00E5C000000UZSmUAO
     QAUser.json: Replacing $R{UserRole.MarketingTeam} with 00E5C000000UZSxUAO
  
  $ sfdx wry:file:replace -u [email protected] -i data  
     Copying data/* to data.out/*
     Account.json: Replacing $R{RecordType.Account.Vendor} with 0125C000000IGVIQA4
     Account.json: Replacing $R{RecordType.Account.Customer} with 0125C000000IGVSQA4
     NewUser.json: Replacing $R{UserRole.CEO} with 00E5C000000UZSmUAO
     QAUser.json: Replacing $R{UserRole.MarketingTeam} with 00E5C000000UZSxUAO

See code: src/commands/wry/file/replace.ts

sfdx wry:hello:org [FILE]

Prints a greeting and your org id(s)!

USAGE
  $ sfdx wry:hello:org [FILE]

OPTIONS
  -f, --force                                      example boolean flag
  -n, --name=name                                  name to print
  -u, --targetusername=targetusername              username or alias for the target org; overrides default target org
  -v, --targetdevhubusername=targetdevhubusername  username or alias for the dev hub org; overrides default dev hub 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)   logging level for this command invocation

EXAMPLES
  $ sfdx hello:org --targetusername [email protected] --targetdevhubusername [email protected]
     Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018!
     My hub org id is: 00Dxx000000001234
  
  $ sfdx hello:org --name myname --targetusername [email protected]
     Hello myname! This is org: MyOrg and I will be around until Tue Mar 20 2018!

See code: src/commands/wry/hello/org.ts

sfdx wry:org:limits

Reports limits in a Salesforce instance

USAGE
  $ sfdx wry:org:limits

OPTIONS
  -l, --limits=limits                             List of limits to check (CSV seperated for multiple) (defaults to ALL)
  -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)  logging level for this command invocation

EXAMPLES
  $ sfdx wry:org:limits --targetusername [email protected]
  ConcurrentAsyncGetReportInstances: 200 of 200
  ConcurrentSyncReportRuns: 20 of 20
  DailyAnalyticsDataflowJobExecutions: 40 of 40
  DailyApiRequests: 14419 of 15000
  ...

  $ sfdx wry:org:limits -u [email protected] -l MassEmail,DailyApiRequests,SingleEmail
  MassEmail: 10 of 10
  DailyApiRequests: 14408 of 15000
  SingleEmail: 15 of 15

See code: src/commands/wry/org/limits.ts

About

Plugin for Salesforce SFDX CLI to set explicit record types and roles into JSON data files for a scratch org

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages