Sublime
需要安装 haoIDE插件
配置 haoIDE
{
"keep_local_change_history": false,
"keep_project_name_time_suffix": false,
"projects":
{
"salesforce_test":
{
"api_version": 49,
"default": true,
"login_url": "https://login.salesforce.com/",
// "login_type": "REST", // 如果使用 REST 方式,则不需要 password 和 security_token
"subscribed_metadata_objects":
[
"ApexClass",
"ApexPage",
"ApexTrigger",
"ApexComponent",
"CustomOjbect",
"AuraDefinitionBundle",
],
"username": "100001@qq.com",
"workspace": "/Users/tangxiaofeng/wwwroot",
"password": "abcdefghijkl",
"security_token": "重新设置我的安全标记"
}
}
}
Switch Project
配置文件中 projects 可以配置多个,通过 Switch Project 来切换
New Project
根据当前选中的匹配,新建项目文件
新建第一个 ApexClass
New ApexClass -> Basic
public with sharing class FirstClass {
public static void helloWorld() {
String world = 'World';
System.debug(LoggingLevel.DEBUG, '*** Hello: ' + world);
}
}
将文件部署到服务器
右键 -> HaoIDE -> Deploy To This Server
比较本地文件与服务器文件
右键 -> HaoIDE -> Diff With Server
拉取服务器代码
Update Project
测试
- New ApexClass -> Test
@isTest
private class FirstTestClass {
static testMethod void testMethod1() {
FirstClass.helloWorld();
}
}
将文件部署到服务器
运行测试
- 右键 -> HaoIDE -> Run Test Class
MVC
新建页面
New -> Apex Page (Visualforce Pages)
<apex:page controller="FirstController">
<h1>Salesforce</h1>
<div>{!name}</div>
</apex:page>
新建控制器
New -> Apex Class -> Controller
public with sharing class FirstController {
public String name {get;set;}
public FirstController() {
name = '模板名字映射';
}
}
其它常用功能
操作 | 描述 | 备注 |
---|---|---|
LoginTo -> Debug Log | 快速跳转到日志页面 | |
LoginTo -> Apex Code | 查看代码 | |
Debug -> Truck One | 调试 | 运行测试 能在 salesforce 的 debug 页面看到 |
Document -> Open Documentation | 查看官方文档 | |
Utilities -> Describe sOjbect | 快速查看相关对象的信息 | |
Utilities -> Generate sObject SOQL | 快速查看相关对象的SQL语句 |
快捷键
快捷键 | 描述 |
---|---|
dbd | System.debug(LoggingLevel.DEBUG, '* : ' + ); |
list | List<> = new List<>(); |
set | Set<> = new Set<>(); |
map | Map<> = new Map<>(); |