Sublime中安装HaoIDE Salesforce开发工具 + 配置Lightning Component

场景描述】:入职DTT的第一天,在内网中下载了sublime text3,并按照官方文档将python代码片段拷贝到Sublime的View -> Show Console(快捷键:ctrl + ~),发现安装package control失败。本篇博客将通过一步一步的方式介绍如何配置Salesforce开发环境,并长期保持更新。

解决方案】:去外网中操作

常用快捷键】:
1. 切换项目:Alt + S;
2. 查找某个资源文件,如根据名称查找Apex Class:Ctrl + P(可用Esc隐藏查找框);
3. 快速输入dubug命令:dbi + Enter(System.debug(LoggingLevel.INFO, '*** : ' + ););

HaoIDE安装与配置】: Package Control
1、下载Sublime Text3;
2、安装Package Control:
旧版本:点击View -> Show Console,将https://packagecontrol.io/installation中的Python代码片段拷贝进去即可;
更新版:下载Package Control.sublime-package,将其剪切至Sublime Text 3\Installed Packages目录,并重启Sublime;
快速找到Installed Packages目录:在Sublime上点击Preferences -> Browse Packages...便可进入Sublime Text 3目录;

3、Package Control安装成功后,便可以在Perference最底部看见这一选项;
4、点击Perference -> Package Control,输入Install Package,Loading完Repositories,输入HaoIDE按回车即可安装;
快捷方式:Ctrl + Shift + P并输入Package Control: Install Package,然后输入HaoIDE。

5、Settings -> Settings User,输入下面代码片段来实现多账号切换。
注意:需要改动的地方如下:
1、workspace:改为绝对路径;
2、login_url:sandbox -> test.xxx.com | production -> login.xxx.com;
3、username;
4、password;
5、default:实现多账号切换的总开关。

其中security token非必填项

{
	"workspace": "/Users/xuyan/Documents/Deloitte/Code",
	"projects":
	{
		"wilson_project":
		{
			"api_version": 39,
			"default": false,
			"deploy_options":
			{
				"allowMissingFiles": false,
				"autoUpdatePackage": false,
				"checkOnly": false,
				"ignoreWarnings": true,
				"performRetrieve": false,
				"purgeOnDelete": false,
				"rollbackOnError": true,
				"runTests": "true",
				"singlePackage": true,
				"testLevel": "NoTestRun"
			},
			"login_url": "https://login.salesforce.com",
			"username": "[email protected]",
			"password": "xxx",
			"security_token": "xxx",
			"subscribed_metadata_objects":
			[
				"ApexClass",
				"ApexPage",
				"ApexComponent",
				"ApexTrigger"
			],
			"workspace": "/Users/xuyan/Documents/Deloitte/Code/itsme_web"
		},
		// copy and paste your next project json config file here...
	}
}

Sublime Text 3 License Key For Build 3176】:解决Update Available Alert问题
1. 打开xxx-settings — User文件:Preferences -> Settings,并输入或新增(json) :
"update_check": false

2. 若仍然无法解决Alert,需要通过:Help -> About Sublime Text查明版本信息,并搜索最新License Key,最终将key键入到:
Help -> Enter Keys即可。
Sublime中安装HaoIDE Salesforce开发工具 + 配置Lightning Component_第1张图片

----- BEGIN LICENSE -----
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
76E84F0B CD69BFC7 59F2DFEF E267328F
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
969624E7 DC9CD4D5 717FB40C 1B9738CF
20B3C4F1 E917B5B3 87C38D9C ACCE7DD8
5F7EF854 86B9743C FADC04AA FB0DA5C0
F913BE58 42FEA319 F954EFDD AE881E0B
------ END LICENSE ------

常见问题Q&A】:
场景一:很多小伙伴在部署时,都希望看到更多的src,以下提供解决方案:
Sublime中安装HaoIDE Salesforce开发工具 + 配置Lightning Component_第2张图片

Q1、如何获得更多部署需要用到的metadata?
A1: 见如下可选项:

"subscribed_metadata_objects":
	[
		"InstalledPackage",
		"CustomLabels",
		"StaticResource",
		"ApexComponent",
		"ApexPage",
		"Queue",
		"Role",
		"Group",
		"GlobalValueSet",
		"StandardValueSet",
		"CustomObject",
		"Layout",
		"CustomPageWebLink",
		"EmailTemplate",
		"FlexiPage",
		"CustomTab",
		"CustomApplicationComponent",
		"CustomApplication",
		"Workflow",
		"AutoResponseRules",
		"ApprovalProcess",
		"HomePageComponent",
		"HomePageLayout",
		"CustomObjectTranslation",
		"Translations",
		"GlobalValueSetTranslation",
		"StandardValueSetTranslation",
		"ApexClass",
		"ApexTrigger",
		"ApexTestSuite",
		"Profile",
		"PermissionSet",
		"CustomMetadata",
		"RemoteSiteSetting",
		"CustomSite",
		"SharingRules",
		"Community",
		"CallCenter",
		"ConnectedApp",
		"AppMenu",
		"SiteDotCom",
		"Settings"
	]

Q2、如何获得所有的metadata?
A2:见下图:HaoIDE -> Metadata -> Retrieve All

Sublime中安装HaoIDE Salesforce开发工具 + 配置Lightning Component_第3张图片

Q3、testLevel有哪些?
A3:ANoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg

补充:如何利用sublime将代码从sandbox部署到pro?
Ans: 例如想将写好的代码myClass.cls部署到pro,首先在User Settings将pro环境的testLevel设置为"RunSpecifiedTests",然后在sandbox中打开myClass.cls文件,并切换到pro环境,右键选择"Deploy To Server",然后输入测试类名称或勾选指定测试类,即可部署。

Q4、如果配置好User - Settings,但是出现"API is not enabled for this Organization or Partner"怎么办?
A4:请重新注册一个账号,记得选择Role为Developer,注册链接如下:
https://developer.salesforce.com/signup

Q5、如何使用HaoIDE开发Lightning Component呢?
A5:在Settings - User中设置下订阅元数据对象即可,如下:

"subscribed_metadata_objects": [			 
    "ApexClass",
    "ApexPage",			 
    "ApexComponent",			 
    "ApexTrigger",				 
    "AuraDefinitionBundle"
]

之后就会生成包含下面json片段的metadata:

{
    "metadataObjects": [
        {
            "directoryName": "aura", 
            "inFolder": "false", 
            "metaFile": "false", 
            "xmlName": "AuraDefinitionBundle"
        }
    ], 
    "organizationNamespace": "DTT", 
    "partialSaveAllowed": "true", 
    "testRequired": "false"
}

最后你就可以看到如下src结构:
Sublime中安装HaoIDE Salesforce开发工具 + 配置Lightning Component_第4张图片

你可能感兴趣的:(Salesforce,Experience,Tools,Skill,package,control安装失败,haoide)