Quick Start with Deploy and Retrieve

In this quick start, we add a custom field to an object in our org and then retrieve its metadata into our Salesforce project. Then, we make a simple edit to the field and deploy the changes back to our org.

First, let's add a custom field in an org that you are connected to:

  1. From Setup, enter Object Manager in the Quick Find box, then select Object Manager.
  2. Click Account.
  3. Click Fields & Relationships.
  4. Click New.
  5. For data type, select Date, then click Next.
  6. Enter these field values:
    • Field Label: Created On
    • Description: Date of Account Creation
  7. Click Next, Next, and Save.

Now, let’s retrieve the metadata for this new custom field into our Salesforce project.

  1. Return to your Salesforce project and open Org Browser.
  2. Scroll down to Custom Objects and navigate to Account.
  3. Click the retrieve icon next to Account to run SFDX: Retrieve Source from Org.
  4. From the Activity Bar, click Explorer and navigate to force-app/main/default/object/Account.

In the fields folder, a file named Created_On__c.field-meta.xml contains metadata for your new custom field.

The metadata is:

Let's now make a simple edit to this field and deploy our changes back to our org with a single click.

  1. Edit Created_On__c.field-meta.xml and change the <required> tag value to true to indicate that this custom field is required.
  2. Right-click the objects/Account folder and click SFDX: Deploy Source to Org.
  3. After the command has run successfully, go back to your org and check the details of the Created On custom field to confirm that it’s now a required field.