tffa-sfdx-plugin is a SalesforceDX plugin from Terafina containing tools for scanning and extending digital applications for the financial services industry.
Before you get started, install the required software on your computer.
- Install Java from OpenJDK Runtime Environment 18.9 (build 11.0.2+9) or via brew .Some features in Salesforce Extensions for VS Code depend upon the Java Platform.
- Install sfdx-cli for osx using
npm install -g sfdx-cli
For information about installing Salesforce CLI, see the Salesforce DX Setup Guide.
sf plugins:install @terafina/tffa-sfdx-plugin
You will be prompted to confirm that you want to install an unsigned plugin. Choose yes
This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?: y
To prevent this message from appearing, you can add this to the Allow List by adding an entry for it in $HOME/.config/sfdx/unsignedPluginAllowList.json.
CI Users: As the plugin is not signed, to install it from a Dockerfile or a script:
echo 'y' | sf plugins:install tffa-sfdx-plugin
$ npm install -g @terafina/tffa-sfdx-plugin
$ sfdx COMMAND
running command...
$ sfdx (--version|-v)
@terafina/tffa-sfdx-plugin/23.0.0 linux-x64 node-v20.9.0
$ sfdx --help [COMMAND]
USAGE
$ sfdx COMMAND
...
sfdx help [COMMAND]
sfdx tffa:apexdoc
sfdx tffa:data:export
sfdx tffa:data:import
sfdx tffa:lint
sfdx tffa:meta
sfdx tffa:ping
sfdx tffa:source:apiset
sfdx tffa:source:createfield
sfdx version
Display help for sfdx.
USAGE
$ sfdx help [COMMAND...] [-n]
ARGUMENTS
COMMAND... Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for sfdx.
See code: @oclif/plugin-help
Command to generate apex documentation similar to javadoc based on the comments in apex classes.
USAGE
$ sfdx tffa:apexdoc [--json] [-s <value>] [-d <value>]
FLAGS
-d, --destfolder=<value> directory to generate the api docs
-s, --sourcefolder=<value> [default: .] directory containing sfdx project
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Command to generate apex documentation similar to javadoc based on the comments in apex classes.
Please read more at [Documenting Apex Classes](development-guidelines/documentation).
Once generated you can use vscode plugin [Live
Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) and select index.html from
generated folder and run Open with LiveServer to render the html
EXAMPLES
$ sf tffa:apexdoc
See code: src/commands/tffa/apexdoc.ts
Exports records of specified sobject types from target org into JSON file(s). Primarily used for exporting business configurations.
USAGE
$ sfdx tffa:data:export -s <value> [--json] [-d <value>] [-g <value>] [-o <value>] [-c <value>] [-i] [-u <value>]
[-a <value>]
FLAGS
-a, --api-version=<value> Override the api version used for api requests made by this command
-c, --children=<value>... the child relationships to be included in the exported records; this is not required
for tffa package objects. e.g. tffa__Features__r,tffa__Terms__r child relationships are
auto included when running export command for tffa__Product__c
-d, --outputdir=<value> [default: ./data/configuration] output directory where the JSON files of exported
records will be placed
-g, --groupby=<value> the field to be used for grouping the exported records; records belonging to each group
are placed in separate JSON files (filename suffixed by group name)
-i, --skipconfigplan skip import of exported record JSON files into configuration plan
-o, --orderby=<value>... the fields to be used for sorting the exported records
-s, --sobjecttypes=<value>... (required) sobject types of records to be exported
-u, --target-org=<value>
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Exports records of specified sobject types from target org into JSON file(s). Primarily used for exporting business
configurations.
The export command requires a target org for exporting records. Run this command from within a sfdx project containing
a default username or specify targetusername explicitly.
EXAMPLES
$ sf tffa:data:export --sobjecttypes tffa__Product__c
Fetched 101 records of tffa__Product__c
Writing 24 records to ./data/configuration/Product__c.json
Writing 30 records to ./data/configuration/Product__c1.json
Writing 20 records to ./data/configuration/Product__c2.json
Writing 27 records to ./data/configuration/Product__c3.json
$ sf tffa:data:export --sobjecttypes tffa__DisclosureTemplate__c,tffa__DisclosureChecklist__c,tffa__DisclosureMatrix__c
Fetched 81 records of tffa__DisclosureTemplate__c
Writing 81 records to ./data/configuration/DisclosureTemplate__c.json
Fetched 57 records of tffa__DisclosureChecklist__c
Writing 57 records to ./data/configuration/DisclosureChecklist__c.json
Fetched 144 records of tffa__DisclosureMatrix__c
Writing 144 records to ./data/configuration/DisclosureMatrix__c.json
See code: src/commands/tffa/data/export.ts
Imports data into an org using the SObject Bulk Upsert API. This data can include master-detail relationships. Primarily used for importing business configurations.
USAGE
$ sfdx tffa:data:import [--json] [-f <value>] [-p <value>] [-s <value>] [-i] [-u <value>] [-a <value>]
FLAGS
-a, --api-version=<value> Override the api version used for api requests made by this command
-f, --sobjectfiles=<value>... comma-delimited, ordered paths of json files containing collection of record trees to
upsert
-i, --forceimport force import all sobject files in a plan ignoring any internal file change tracking;
applicable to scratch orgs only; forceimport is automatically set if sobjecttypes
parameter is specified
-p, --plan=<value> [default: data/configuration/config-data-plan.json] path to plan to upsert multiple
data files that have master-detail relationships; to restrict the sobject types
imported using the plan, specify sobjecttypes along with plan
-s, --sobjecttypes=<value>... comma-delimited, list of sobject types to be imported when using a plan
-u, --target-org=<value>
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Imports data into an org using the SObject Bulk Upsert API. This data can include master-detail relationships.
Primarily used for importing business configurations.
To generate JSON files for use with tffa:data:import, run "sf tffa:data:export"
In scratch orgs, by default, sobject files are tracked for changes. When doing full plan imports (without the
sobjecttypes parameter), individual sobject files are tracked for changes and excluded from import if the file content
remained unchanged since the last time it was imported. This behaviour can be suppressed by including the forceimport
flag when doing full plan imports.
EXAMPLES
$ sf tffa:data:import
(Imports all records from default plan - data/configuration/config-data-plan.json
- Updated 101 record(s) of tffa__Product__c
- Updated 532 record(s) of tffa__ProductFeature__c
- Updated 143 record(s) of tffa__ProductTerm__c
Importing record(s) and relationships of tffa__Product__c... done
- Updated 5 record(s) of tffa__DependentProductEligibility__c
Importing record(s) and relationships of tffa__DependentProductEligibility__c... done
$ sf tffa:data:import -p data/configuration/config-data-plan.json
(Imports all records from default plan - data/configuration/config-data-plan.json
- Updated 101 record(s) of tffa__Product__c
- Updated 532 record(s) of tffa__ProductFeature__c
- Updated 143 record(s) of tffa__ProductTerm__c
Importing record(s) and relationships of tffa__Product__c... done
...
$ sf tffa:data:import -s tffa__Product__c
(Imports only tffa__Product__c from data/configuration/config-data-plan.json)
- Updated 101 record(s) of tffa__Product__c
- Updated 532 record(s) of tffa__ProductFeature__c
- Updated 143 record(s) of tffa__ProductTerm__c
Importing record(s) and relationships of tffa__Product__c... done
...
$ sf tffa:data:import -f data/configuration/DisclosureTemplate__c.json,data/configuration/AddOnService__c.json
(Imports tffa__DisclosureTemplate__c and tffa__AddOnService__c from the files; ignores config data plan)
- Updated 82 record(s) of tffa__DisclosureTemplate__c
Importing record(s) and relationships of tffa__DisclosureTemplate__c... done
- Updated 30 record(s) of tffa__AddOnService__c
Importing record(s) and relationships of tffa__AddOnService__c... done
See code: src/commands/tffa/data/import.ts
Scans a sfdx project and provide a violations report based on defined standards.
USAGE
$ sfdx tffa:lint [-j] [-s <value>] [-m <value>] [-r <value>] [-e] [-f]
FLAGS
-e, --eject update local pmd ruleset
-f, --level emit fatal violations only
-j, --json generate json output
-m, --minapi=<value> [default: 61] minimum api version to use during quality checks
-r, --rulesetpath=<value> path to pmd ruleset
-s, --sourcefolder=<value> [default: .] directory containing sfdx project
DESCRIPTION
Scans a sfdx project and provide a violations report based on defined standards.
Performs static analysis of source code with a command-line interface and report output.
The command creates "Rule Violations" when the it identifies issues. Developers use this information as feedback to
fix their code.
The rules used in the lint command are:
- [Apex PMD](https://pmd.github.io/latest/pmd_rules_apex.html) to statically analyse Apex Code to find design,
performance and security vulnerabilities. It allowes us to have a better quality and avoid maintenance, performance
and bug problems in our Apex code. for Salesforce apex classes are scans during build and development process.
- Custom rules
- Custom Objects should have a description
- Custom Fields should have a description'
- Custom fields should not contain underscores.
- Custom fields in managed object should start with CZ.
- Custom objects should start with CZ.
- Using Metadata API Version and Project source api version should be the latest supported.
- Files violating naming conventions
- Do not use isCreateable, isAccessible, isUpdateable, CRUD/FLS Checks are checked by tffa.AbstractRepository
- Do not call methods directly of an abstract class. Call methods from Repository classes extending
tffa.AbstractRepository
- Do not call methods directly of an abstract class. Call methods from Controllers classes extending
tffa.AbstractController',
- Do not call methods directly of an abstract class. Call methods from RESTService classes extending
tffa.AbstractRESTService
- Any SOQL should be encapsulated into Repository classes extending tffa.AbstractRepository. Use doQuery method
- Do not supress PMD warnings using @SupressWarnings
The lint command is integrated into the jenkins build to report violations and fail builds
EXAMPLES
$ sf tffa:lint
See code: src/commands/tffa/lint.ts
Scan a sfdx project for generating metadata summary information
USAGE
$ sfdx tffa:meta [--json] [-s <value>] [-d <value>] [-c <value>] [-o json|csv|human] [-f]
FLAGS
-c, --clientname=<value> [default: .] name of the client
-d, --destpath=<value> [default: .] full path output file
-f, --fields generate field output
-o, --output=<option> output format json csv human
<options: json|csv|human>
-s, --sourcefolder=<value> [default: .] directory containing sfdx project
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Scan a sfdx project for generating metadata summary information
EXAMPLES
$ sf tffa:meta
See code: src/commands/tffa/meta.ts
Ping and test the plugin
USAGE
$ sfdx tffa:ping [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Ping and test the plugin
EXAMPLES
$ sf tffa:ping
See code: src/commands/tffa/ping.ts
Upgrades the current project and all metadata to the latest API version
USAGE
$ sfdx tffa:source:apiset [--json] [-s <value>] [-a <value>]
FLAGS
-a, --api=<value> [default: 61] specify the API version
-s, --sourcefolder=<value> [default: .] directory containing sfdx project
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Upgrades the current project and all metadata to the latest API version
EXAMPLES
$ sf tffa:source:apiset
See code: src/commands/tffa/source/apiset.ts
Creates an SObject field from the specified parameters.
USAGE
$ sfdx tffa:source:createfield -s <value> -n <value> -t
checkbox|currency|date|datetime|email|number|percent|phone|picklist|picklist-multi|text|textarea|textarea-long|texta
rea-rich [--json] [-r] [-l <value>] [-d <value>] [-p <value>] [-v <value>]
FLAGS
-d, --description=<value> description of the field
-l, --length=<value> length of text field or textarea (long|rich) field; defaults to 255 for text field
and 1024 for textarea field
-n, --name=<value> (required) the API name of the field
-p, --permissionsets=<value>... comma-separated list of permission sets to which the field needs to be added;
defaults to all permission sets in the project
-r, --required whether field is required; skips addition to permission sets
-s, --sobjecttype=<value> (required) the API name of the object for which the field needs to be created
-t, --type=<option> (required) [default: text] type of the field
<options: checkbox|currency|date|datetime|email|number|percent|phone|picklist|picklis
t-multi|text|textarea|textarea-long|textarea-rich>
-v, --valuesetname=<value> name of the global value set if the field is a picklist or multi-select picklist type
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Creates an SObject field from the specified parameters.
By default, created fields (except required) are added to all permission sets in the project. Use the permissionsets
parameter to explicitly specify the permission sets.
NOTE: this command does not create the field in the org, it only creates the field meta xml file in the project.
source push is required for the field to be created in the org.
EXAMPLES
sf fa:source:createfield -s Product__c -n TextField -t text -d "Test Text Field"
Creates a text field
sf tffa:source:createfield -s Product__c -n TextField -t text -d "Test Text Field" --required
Creates a required text field; does not add update permission sets as field is required
sf tffa:source:createfield -s Product__c -n TextField -t text -d "Test Text Field" --length 80
Creates a text field with length 80
sf tffa:source:createfield -s Product__c -n TextField -t text -d "Test Text Field" --permissionsets Administrator
Creates a text field and adds the field permission to Administrator permission set only
sf tffa:source:createfield -s Product__c -n CheckboxField -t checkbox -d "Test Checkbox Field"
Creates a checkbox field
sf tffa:source:createfield -s Product__c -n CurrencyField -t currency -d "Test Currency Field"
Creates a currency field
sf tffa:source:createfield -s Product__c -n PicklistField -t picklist -v ProductCategory -d "Test Picklist Field"
Creates a picklist field with global value set ProductCategory
sf tffa:source:createfield -s Product__c -n LongTextAreaField -t textarea-long -d "Test LongTextArea Field"
Creates a long textarea field
See code: src/commands/tffa/source/createfield.ts
USAGE
$ sfdx version [--json] [--verbose]
FLAGS
--verbose Show additional information about the CLI.
GLOBAL FLAGS
--json Format output as json.
FLAG DESCRIPTIONS
--verbose Show additional information about the CLI.
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
See code: @oclif/plugin-version