0

I'm looking for a way to custom create a placeholder formula field. SOAP doesn't allow formula field.

I see a few ways online using force.com IDE, but now I'm trying it out on VSCode and I'm kind of lost. I'm able to generate an xml file for each field, then right click and "Deploy Source to Org", but that doesn't sound like the best way of creating a lot of fields.

Code for example

sfdx force:source:deploy --sourcepath c:\Users\xxxx\Documents\Salesforce\force-app\main\default\objects\Account\fields\sample1234__c.field-meta.xml --json --loglevel fatal

File:

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Sample1234__c</fullName>
    <externalId>false</externalId>
    <formula>&apos;placeholder&apos;</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>Sample1234</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <type>Text</type>
    <unique>false</unique>
</CustomField>

1 Answer 1

1

You can use good old package.xml and ANT for deploying bulk of components (custom placeholder fields in your case) through a single deployment command. All the custom fields should be listed in the package.xml. Refer to this, this & this to explore this option. You can find many blogs and article related to this on the web.

If you want to stick with VS Code and SFDX, then the same above mentioned package.xml and the following SFDX CLI command should help you:

sfdx force:source:deploy -x path/to/package.xml

force:source:deploy has been detailed extensively in the Salesforce CLI command reference. package.xml is usually placed under a manifest folder within SFDX project root directory.


You may also right click on the fields folder under specific object (you can include only the required custom fields in the folder) and deploy it. See screenshot below.

enter image description here

or enable push-or-deploy-on-save setting under Salesforce Feature Previews in the VS Code preferences window. [Be cautious about this setting, especially if you are working in a team environment, because this will push all components as you save them locally and may exhibit intermittent performance lag]

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .