force-md

command module
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 1 Imported by: 0

README

force-md

Manipulate Salesforce metadata.

Usage

See docs/force-md.md for all supported commands.

The commands are long, but tab completion makes them relatively painless. Enable bash completion or see force-md completion --help for other options.

$ source <(force-md completion bash)

Examples

Below are some basic examples. See the wiki for higher level examples.

Tidy Permission Sets

Clean up metadata by sorting groups of elements in natural order.

$ force-md permissionset tidy src/permissionsets/*
Clone Field Permissions

Add field permissions for a new field to Permission Sets by copying the permissions from another field.

$ force-md permissionset field-permissions clone -s Account.My_Field__c -f Account.New_Field__c src/permissionsets/*
Merge Permission Sets

Grant all permissions from a source permission set to another permission set.

$ force-md permissionset merge -s src/permissionsets/Subset.permissionset src/permissionsets/Superset.permissionset
Add Class

Enable access to an apex class

$ force-md permissionset apex add -c MyClass src/permissionsets/My_Permission_Set.permissionset
Add Tab

Enable tab visibility

$ force-md permissionset tab add -t My_Tab src/permissionsets/My_Permission_Set.permissionset
Add Object Permissions to Profiles

Add object permissions to Profiles. All permissions will default to false; use profile object-permissions edit to update.

$ force-md profile object-permissions add -o Account src/profiles/*
Update Object Permissions

Update the Read, Create, Edit, Delete, View All, and Modify All permissions on Profiles. Any permissions not specified on the command line will be left unchanged.

$ force-md profile object-permissions edit -o Account -e -D src/profiles/*
Copy and Convert Metadata

Copy metadata between source format (SFDX) and metadata format (MDAPI). Automatically handles merging/splitting of CustomObjects and CustomObjectTranslations.

$ force-md copy src -t sfdx -f source      # Convert from metadata to source format
$ force-md copy sfdx -t src -f metadata    # Convert from source to metadata format
$ force-md copy src -t sfdx -f source -x package.xml  # Convert with package.xml filter

The -x flag allows filtering metadata based on a package.xml file:

  • Named components: Only the specified components are copied
  • Wildcards (*): All components of that type are copied
  • Mixed (wildcards + named): All components are copied, but fails if any named component is missing

Developing

To add support for a new metadata type, zek can be useful for getting started by generating a struct that matches the XML structure, e.g.

$ zek -C -m src/queues/*

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
pkg
dw
lwc
pkg
Package registry provides metadata type registry information without circular dependencies
Package registry provides metadata type registry information without circular dependencies

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL