Topic
- Use SalesforceXytoolsForSublime to develope sfdc
- create/update/delete/refresh local file : ApexClass, ApexTrigger, ApexPage, ApexComponent
- Diff between localhost and server
- Open metadata in sfdc
- Deploy : ApexClass, ApexTrigger, ApexPage, ApexComponent, Lightning
- Run Test Class
Environment
- Make sure you can login your sfdc. Test it : SFDC-XY > Login SFDC
Start Develope
Create ApexClass
This is an example of batch apexclass.
Step1. New ApexClass
Metadata > New ApexClass
Tips : Create ApexClass, ApexTrigger, ApexPage, ApexComponent in the same way
Step2. Select Apex template
Tips: search batch
Input your batch name
global class SampleBatch1 implements Database.Batchable<sObject> {
String query;
global SampleBatch1() {
}
global Database.QueryLocator start(Database.BatchableContext BC) {
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<sObject> scope) {
}
global void finish(Database.BatchableContext BC) {
}
}
Update ApexClass
Change your apexclass,
Right click, SFDC-XY Metadata
> Save To Server
Refresh From Server
Right click, SFDC-XY Metadata
> Refresh From Server
Delete
Right click, SFDC-XY Metadata
> Delete this metadata(Danger)
It will pop up a dialog like this.
Diff between localhost and server
Config your Winmerge
Project Setting
> Open Project Config file
set your winmerge
like below.
.......
"app": {
"Bash": "cmd /k cd /d {file_dir}",
"winmerge": "C:\\Program Files (x86)\\WinMerge\\WinMergeU.exe",
"notepad": "C:\\Program Files (x86)\\Notepad++\\notepad++.exe {file_name}"
},
.......
Diff source
Right click, SFDC-XY Metadata
> Diff with Server
if you do not set winmerge
, it will use simple diff.
Find your source in sfdc
Right click, SFDC-XY Metadata
> Save To Server
It will go to sfdc source page.
Deploy To SFDC
There are some different between Deploy and save.
Right click, SFDC-XY Metadata
> Deploy To Server(Ant Migration Tool)
There 4 ways to deploy to sfdc server. If you select check only , it never actually saves to the server.
-
Deploy Open Files To Server:
-
Deploy Open Files To Server(check only):
-
Deploy Current File To Server :
xxx.cls
-
Deploy Current File To Server :
xxx.cls
(check only)
Deploy the folder
choose your folder or source in sublime folders, then right click.
Find the menu : Sfdc-Xy > Deploy Directory To SFDC
Run Test Class
Right click, SFDC-XY Run
> Run Test Class
Summary
Project
New Project
Project > New Project
Input your project directory, and create your sfdc project
Switch Project
Project > Switch Project
Retrieve Source
Project > Retrieve Source
Select metatdata type, and click Start To Retrieve
to retrieve source.
The old source src
directory will be remove to src_backup
Retrieve Source zip
Project > Retrieve Source.zip
Input your project directory, and retrieve zip.
Reload Metadata Cache
Project > Reload Metadata Cache
Not need to Reload Metadata Cache.
Metadata
Create ApexClass, ApexTrigger, ApexPage, ApexComponent
Metadata > New ApexClass
Metadata > New ApexTrigger
Metadata > New ApexPage
Metadata > New ApexComponent
Refresh Source
Metadata > Refresh From Server
Diff with Server
Metadata > Diff with Server
If you want to use winmerge
to check the different between local and server,
Please config /.xyconfig/xyconfig.json
, set winmerge
.
If you set winmerge
blank, it will diff in sublime.
Tips: You must use
\\
if you use Windows, such as"C:\\Program Files (x86)\\WinMerge\\WinMergeU.exe"
Save To Server
Metadata > Save To Server
Deploy To Server
Please use Migration Tools to deploy sources.
Migration Tool > Ant Migration Tool