Search code examples
salesforceapex

How to - auto retrieve SF project when oppening VS code?


The feature i'm looking for - Every time i open my sf project file in vs code, the command - "SFDX: Retrieve Source in Manifest from Org" will happen automatically. Thanks in advance.


Solution

  • Auto retrieve when opening a Salesforce project in VSCode:

    1. Ctr + shift + p  Search for the: ‘Tasks: Configure Task’:

    a. Press :

    1

    b. Then:

    2

    1. Add this task to the ‘Tasks’ list:

    { "label": "Run Retrieve Manifest From Org on startup", "type": "shell", "command": "sfdx force:source:retrieve -x manifest/package.xml", "windows": { "command": "sfdx force:source:retrieve -x manifest/package.xml" }, "presentation": { "reveal": "always", "panel": "new" }, "runOptions": { "runOn": "folderOpen" } }

    a. Should look similar to this: 3

    1. Enable Automatic tasks for this project:

    a. Ctr + shift + p  Tasks: Allow automatic Tasks in Folder

    4

    b. Enable it.

    1. Reopen the project & u should see this running in the terminal:

    5