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

Apex Regex Extract Numeric Value from String

3  Asked on January 6, 2022 by yossi-cadaner


Ignore files when force:source:convert

4  Asked on January 6, 2022 by simonp


AuthToken using Open Id Connect

1  Asked on January 6, 2022 by bergin-panimayam


Using IsPickVal() function inside Email Templates

1  Asked on January 6, 2022 by anthony-williams


Create record by submitting string for reference field

1  Asked on January 4, 2022 by user85715


Ask a Question

Get help from others!

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