function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vishnu SanthoshVishnu Santhosh 

How to retrieve the Apex classes alone, without other components like Aura, Lightning page etc into VS Code from Salesforce Sandbox org ?

Hi,

I am new to Salesforce Apex Development and currently working on Apex classes and Apex Test classes alone. To fetch data from org, what I am currently following is to use the SFDX:Retrieve source in manifest from org command in the Package.xml file. So,it retrieves all the data ( including Lighning pages, Aura components,etc). 

I saw there are several types mentioned in the Package.xml file. So my question is how can i fetch the Apex classes alone insteading of fetching all the data into the VSCode from Org ?

Does modifying the package.xml file will do? If so, can you please give a small explanation on that ?

Thank you :)

Best Answer chosen by Vishnu Santhosh
ShivankurShivankur (Salesforce Developers) 
Hi Vishnu,

Yes, you can modify the package.xml to retrieve the components you want.

You can use a part in your package.xml like below to just retrieve the Apex Classes from your autheticated org:
<types>
    <members>*</members>
    <name>ApexClass</name>
</types>
Reference for more examples:
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/manifest_samples.htm

Hope above information helps, Please mark as Best Answer so that it can help others in the future.

Thanks.