A simple library which uses Custom Metadata to manage simple Key/Value Environment variables. Includes a custom UI to make configuration as easy & error free as possible.
via sfdx-cli
sfdx force:package:install --package 04t6O000001J2gsQAC -u [email protected]
via url
login and navigate to /packaging/installPackage.apexp?p0=04t6O000001J2gsQAC
. Choose Install for: Admin Only
.
This project has been updated to a namespaced unlocked package. If you installed before the namespace was added, and want to stay up-to-sync with the latest improvements, then please follow the manual migration process!
- Open Environment Variables from the app switcher (or "tabs" in classic)
- Add and Save some env-vars
- Use in Apex, Formulas or javascript applications.
//basic usage
Map<String,String> fieldMap = (Map<String,String>) VARS.ENV.get('MY_MAP');
//with a string transform
Map<String,String> fieldMap = (String[]) VARS.ENV.get('MY_ARRAY', VARS.ENV.Transform.TO_LOWER);
// with ANY json
Foo fieldMap = (Foo) VARS.ENV.get('MY_FOO', Foo.class);
$CustomMetadata.VARS__ENV__mdt.FIELD_MAP.Val__c
Note: Only the first 255 characters will be returned in formula!
String
Integer
Decimal
Boolean
: Format:true
orfalse
String[]
: Format:["a","b","c"]
Map<String,String>
: Format:{"456":"xyz","123":"abc"}
ANY
: Any valid JSON string
- Simple type checking on primitive types.
- ability to apply JSON Schema to
ANY
json type!
In order to enable, follow these instructions.
Quickly filter VARS based on either key or value string search.
Automatically formats JSON after editing
Add information about how it's used, how to manage it, etc
Project Overview:
env-vars
: Salesforce metadata for core env-vars functionalityapp
: React UI for managing env-vars. Uses B.A.S.S. Stackenv-vars-encrypt
: managed package to allow for "secret" varssf-env-vars-npm
: npm package to make using env-vars easy in js applications
** Powered by ** Callaway Cloud Consulting