4

Currently I'm trying to change from Sublime and mavensmate to Visual Studio Code with the salesforce extension pack. The only thing that holds me back is that I don't know to configure the VS code to check the code in the server before deploying it to avoid code overwriting. You can find this funcionality in mavensmate and in the Intelj plugin. Does anyone know how to configure the VS code to implement this funcionality. Thanks a lot.

2
  • 1
    What commands are you using / how are you deploying code to server? I believe this kind of functionality is on the SFDX roadmap, but not available as of Summer '19. In general, using version source control like git and an online repo should be the model to use as the source of truth moving forward Jul 24 '19 at 8:50
  • I made this same move from Sublime/MavensMate to VS Code/DX at the beginning of the year :-) Jul 24 '19 at 8:50
1

@Alleren I think this is a major flaw of Salesforce Expansion Pack. There is an issue in github related to that https://github.com/forcedotcom/salesforcedx-vscode/issues/971

This is a big disadvantage of this product comparing to all competitors which have this feature.

It is not possible to configure Salesforce Expansion Pack until this is implemented for the corresponding github issue so that this issue is fixed

4

Using the VS Code Salesforce extension pack and their "SFDX: Deploy This Source to Org" command actually uses different deployment methods depending on the org your developing against.

As per Develop Against Any Org documentation, if you're developing against a scratch org (i.e. you set it as your Default org), then it uses the force:source:push command, which indeed checks for merge conflicts. If you're deploying against a non-sourced org, like Sandbox or Production, it uses the force:source:deploy command, which always overwrites whatever is in the org:

The source:deploy command works differently from source:push for scratch orgs. The source you deploy overwrites the corresponding metadata in your org, similar to running source:push with the --force option...

There is a safe harbor statement that Sandbox orgs might get this force:source:push functionality with source-tracking and merge conflict checking, but we won't see that (and probably it'll be in beta) until Winter 20 or after.

1
  • 1
    Thanks a lot for the answer, it was realy usefull.
    – Allleren
    Jul 25 '19 at 10:05
1

This isn't an exact answer for your question but it definitely is a way to do what you're looking for, so if you Right-Click on any file in vscode-dx and you'll have the option

SFDX: Diff File Against Org

A sample use case: You have a sandbox org and a full org (used for staging and QA) and you also have a develop repo which you branch out from and create your feature in the branch. After you're done with your dev and your PR is approved you merge your branch with the develop branch and now it's time to deploy to org and regardless of your deployment method, (creating change-set vs deploy to org using vscode), you'll want to diff to make sure you're not overwriting anything in your full org, so you change your org from sandbox to full in the vscode and I'd also change my repo to develop(since I've already merged my branch) and now on each file I Right-Click and use the SFDX: Diff File Against Org and then deploy the file to org

Just in case you're interested, I'm putting down the link to Salesforce Developer Documentations for Salesforce-DX, there are so many useful information in there: Salesforce DX Developer Guide

I hope this helps, Cheers!!

0

Salesforce Extension Pack for VSC does have beta feature:

https://developer.salesforce.com/tools/vscode/en/user-guide/detect-conflicts

Whenever you retrieve or deploy source to keep the local project and your default org in sync, the operation could detect conflicts. The conflict detection feature is available only in non-scratch orgs such as sandboxes or dev orgs.

If conflicts are detected, you can cancel the retrieve or deploy operation and view the differences between your local project and default org.

To view the files that caused conflicts, click the Org Differences icon () in the Activity Bar. The Org Differences: Conflicts view opens in the Side Bar and displays the list of files with conflicts. To resolve conflicts, click a file to open the diff editor and compare the remote file (to the left) with the local file (on the right). To edit a file, hover over the file name and click the open file icon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.