New answers tagged

0

As the error says, the class is already virtual, so just remove the virtual keyword on the class: public class fetchContact { public virtual void getContact(){ Contact contact1 = [Select Id,Name FROM Contact where (LastName = 'Yona')]; system.debug(contact1); } }


1

You can't fix this because the format in the repostiory is the old metadata format which is not supported in VS Code. Because legacy tools such as Force.com IDE used the metadata format, you can’t directly open your such projects in VS Code. You must either convert your metadata to source format (using sfdx force:mdapi:convert) or create a new ...


4

Instantiate a new contact object and add values to it and add it to the list like below Check this link for ( Integer count = 1; count<=5; count++) { contact eachContact = new contact(); eachContact.LastName = ('Richie' + count); eachContact.Phone = 9876543210; contactlist.add(eachContact); } ...


2

You can create your custom code snippets in the VS Code. Go to File -> Preference -> User Snippets in the VS Code. You can create your own snippets there, just select the language and it will open the file. Just put all your snippets in this format. // apex.json "apex if":{ "prefix":"if", "body": [ "if ( ${1:condition} ) {\n\t$2 \n}" ] ...


0

This worked for me (without uninstalling VS Code): Uninstall Salesforce Extension Pack from VS code extensions Delete all salesforce related folders under the vs code extensions folder, you can find them in: Windows %USERPROFILE%.vscode\extensions macOS ~/.vscode/extensions Linux ~/.vscode/extensions Install Salesforce Extension Pack back ...


2

For the code completion suggestions to work, it relies on the SObject definitions being refreshed as opposed to whether you've retrieved the new metadata. You can do this by using the Command Palette (CTRL+Shift+P) and running the following action SFDX: Refresh SObject Definitions


0

*.js-meta.xml files are getting created along with component whenever we are creating it. Until and unless we are hiding certain files as stated by Mathew Souther , these will be visible by default. Also, pleas try to refresh your folder after creating component. I have seen instances when this file comes after folder refresh in VS-Code


3

In the VSCode Settings, (either in workspace or user) you might have something like **/*-meta.xml in your Files: Exclude section you should change that to specify the ones you really want to hide, for example **/*.cls-meta.xml. Have a look also to the Search: Exclude section


1

I need to update the .prettierrc in root directory, not the extension settings { "trailingComma": "none", "overrides": [ { "files": "**/lwc/**/*.html", "options": { "parser": "lwc" } }, { "files": "*.{cmp,page,component}", "options": { "parser": "html" } } ], "printWidth": 120 }


0

I had this issue even though I had a project open with a sfdx-project.json in the root. What ended up being the problem is that my folder path had a space at the end (don't ask me why, not sure): "C:\path\to\folder \" <-- Notice the space at the end So my two suggestions: Check your project's file path Use the developer console in VSCode (go to Help -> ...


2

There's no absolute foolproof way, but you can give yourself some assurances. First, set the Default Dev Org before you start working. You'll see which org you're connected to in the lower-left corner: Almost all VSCode commands work on the default org, as well as commands in the terminal. The only exceptions are those that explicitly use a Dev Hub Org, ...


1

One work-around I noticed that seems to have worked for me is: Generate a password for your scratch org user via sfdx force:user:password:generate Perform a web authentication via SFDX sfdx force:auth:web:login --instanceurl https://test.salesforce.com RESTART VSCODE and re-open the project. Metadata/tools now show up. This feels like a bug - EG, after ...


5

This is not a feature of the Salesforce Extension Pack and instead a setting in your VSCODE Editor. Go to Settings> TextEditor Settings and Enable "Show Variables". Check the official docs here and below settings should be turned on //When enabled IntelliSense shows `value`-suggestions. `"editor.suggest.showValues": true`, //When enabled ...


0

I changed my entire process for retrieve from Packaging Org and now I have no conflicts on deploy to Dev Org. auth into packaging org sfdx force:mdapi:retrieve -s -r ./mdapipkg -p PackageName 
- unzip only to get the package.xml refer to this package.xml in Step 3 sfdx force:source:retrieve -x /Users/me/Dev/____/salesforce-app/mdapipkg/unpackaged/package....


1

This is as per the design. If you need this capability and have feedback I suggest raising it on the project github. You can use the issue tab to describe your need and that would let the product team consider and prioritize it.


2

There seems to be a couple of different problems here. First, we need to be clear about which commands are being used to deploy which type of metadata. Salesforce DX-format source is deployed by sfdx force:source:deploy Metadata API-format source is deployed by sfdx force:mdapi_deploy. If converting MDAPI to SFDX format does not succeed, it is unlikely ...


Top 50 recent answers are included