Retrieve custom fields from standard objects using sfdx force:source:retrieve

This syntax was what I needed

sfdx force:source:retrieve -m CustomField:Claim.CveClaim__c

to retrieve my custom field CveClaim__c that I added to the (standard in FSC object) Claim. The -m CustomObject:Account will pull back all the fields of that object - standard and custom.


You have to specifically name the objects you want, e.g. -m CustomObject:Account,Opportunity

Alternatives I know of:

1) Use this VSCode plugin to easily produce a package.xml by point and click, then retrieve against that.

https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator

2) Use shane-sfdx-plugins which supports a syntax sfdx shane:mdapi:pull --type=CustomObject but will actually pull standard objects too.

https://github.com/mshanemc/shane-sfdx-plugins

Tags:

Salesforcedx