HomeGuidesDeveloper HubRelease Notes
Get supportBook a chat
Developer Hub

Store Salesforce Metadata in Repository

Let's begin with retrieving your Salesforce metadata and storing it in a GitHub repository.

Create a GitHub Repository for your Project

Your GitHub repository will be the source of truth of your Behavior App. From there, you will source-control your app metadata and Fielo configurations.

Requirements:

  • Github user

Steps to create a new repository:

  1. Navigate to your personal GitHub (https://github.com/<your username>/)
  2. Click on the Repositories tab.
  3. Click new.
  4. Enter a name that fits your repository.
  5. Leave the default values.
  6. Click on Create repository.

Example:

1446

Creating a new repository

Create Your Salesforce DX Project

  1. Using VSCode, hit Ctrl + Shift + P (on Windows) or Command + Shift + P (on Mac), then choose SFDX: Create Project from the dropdown that will appear.
📘

This command only works inside a DX project. You have to go to an existing project to execute this.

  1. Select Standard project template:
1568

Choosing a project type

  1. Give it a proper name:
1488

Naming the project

  1. In the end, you will have to choose a folder to place it. Usually, we choose our workspace as the root folder and we place the new project on the next level.
530

Folder example

In the previous example, we created all SFDX (Salesforce DX) projects under the folder "sfdx" in our workspace. But feel free to create it the way that is better for you.

Add Your Local Project to Your GitHub Repository

Open the new project that you just created, open the terminal, and execute the following commands:

git init
git add .
git commit -m "First commit"
git remote add origin <REMOTE_URL>
git remote -v
git push -u origin master

Where the <REMOTE_URL> can be retrieved from:

2390

OR

784
📘

You can check more information about how to sync your repository at Adding a project to GitHub without GitHub CLI.

After you execute these commands, your local project is in sync with your GitHub repository.

Authenticate Your Dev Orgs in Your Project

Before retrieving your project's metadata, you must authenticate the Orgs in your project.

  1. Using VSCode, hit Ctrl + Shift + P (on Windows) or Command + Shift + P (on Mac)
  2. Choose SFDX: Authorize an Org from the dropdown that will appear.
1458

Choosing 'Authorize an Org'

  1. Next, choose Project Default:
1466

Choosing 'Project Default'

  1. Give a proper name to it:
1474

Naming the project

Now you are ready to start retrieving your project's metadata.

Retrieving Salesforce Metadata

Once you know what kind of metadata you are using, you can retrieve them from the Org using Salesforce DX. To get the list mentioned before, we executed the following commands:

# retrieve classes
sfdx force:source:retrieve -m ApexClass:F_Cases,ApexClass:TestF_Cases

# retrieve trigger
sfdx force:source:retrieve -m ApexTrigger:F_Cases

# retrieve fields
sfdx force:source:retrieve -m CustomField:Case.Member__c
sfdx force:source:retrieve -m CustomField:Case.SLAInDays__c
sfdx force:source:retrieve -m CustomField:Case.SLAInHours__c
sfdx force:source:retrieve -m CustomField:FieloPLT__Point__c.Case__c
sfdx force:source:retrieve -m CustomField:FieloPLT__Transaction__c.Case__c
sfdx force:source:retrieve -m CustomField:FieloPLT__Tracker__c.Case__c

# retrieve permission set
sfdx force:source:retrieve -m PermissionSet:CasesAppPermissionSet

When you have the metadata in your hands, add all files you just retrieved from the Org to your Github repository. Commit and push them using commands such as:

git add .
git commit -m "Project Metadata"
git push