DX CLI - Custom Settings

Salesforce Asked by trebleCode on January 2, 2022

I’ve not found conclusive answers around DX and deploying/retrieving custom settings in a sandbox or production org.

I did see this: DX Orgs and Custom Settings

But that post is over a year old at this point. Haven’t seen anything in the DX release notes about custom settings.

Is this still not possible to deploy or retrieve via the CLI? Is this technically possible otherwise via SOAP? If anyone can share a developer doc illustrating possibilities it would be sincerely appreciated.


One Answer

The custom settings metadata can be retrieved or deployed just like any other metadata.

All you need is name of the custom setting

If you are working in orgs that cannot have source tracking enabled

sfdx force:source:retrieve -m CustomObject:<Customsettingname__c>

If you are using source tracked orgs use

sfdx force:source:pull

If you want data within these custom settings then you can use soql

sfdx force:data:soql:query -q "SELECT Id, Name FROM Customsettingname__c"

You can export the data to the local folder using

sfdx force:data:tree:export -q "SELECT Id, Name FROM Customsettingname__c" -x export-customsetting -d /tmp/sfdx-out -p

And then load the exported custom setting data into a target scratch org with

sfdx force:data:tree:import -p /tmp/sfdx-out/export-customsetting.json

Answered by Mohith Shrivastava on January 2, 2022

Add your own answers!

Related Questions

Fetch Field Label in Lightning Web Components

1  Asked on November 5, 2021 by pranay-jaiswal


Nested array/for loop

1  Asked on November 5, 2021 by user85246


Ant validation/deployment errors using sessionId

0  Asked on November 5, 2021 by szosteczka


Set a default value for a lookup field

1  Asked on October 4, 2021 by aurlien-laval


Class to update lookup failing

1  Asked on October 4, 2021 by phuc


Push fail for “force:source:push

1  Asked on October 4, 2021 by noor-a-shuvo


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir