Agenda¶
Use xycode and Salesforce CLI to develope sfdc.
config¶
Config for windows user: xycode.sfdx.json
Config for linux user: xycode.sfdx.json
Config for mac user: xycode.sfdx.json
Solution¶
Create a project¶
force:project:create
Authentication¶
force:auth:web:login
Retrieve metadata¶
force:source:retrieve:metadata
Deploy metadata¶
force:source:deploy:metadata
force:source:deploy:current_file
Diff metadata¶
force:source:diff:metadata
You can diff with any sfdc organization.
diff source¶
diff profile¶
Useful Tips¶
auto run apex anonymous code¶
auto run apex anonymous code after save .apex.
change the config: ~/.xycode/xycode.sfdx.json
set inActive
false as below.
"onSaveEvents": [ { "label": "auto run apex anonymous code.", "description": "run apex anonymous code after save.", "filetypes": [".apex"], "cwd": "${fileDirname}", "inActive": false, "command": "sfdx force:apex:execute --apexcodefile \"${file}\"" } ]
also, you can write a command and run .soql
after you save.
pretty apex code¶
"onSaveEvents": [ { "label": "pretty apex code.", "description": "use prettier-plugin-apex to format salesforce apex code. npm install --global prettier prettier-plugin-apex ", "filetypes": [".trigger", ".cls"], "cwd": "${fileDirname}", "inActive": true, "command": "prettier --parser=apex --write \"${file}\" --tab-width=4 --single-quote=true" }, { "label": "pretty apex anonymous code.", "description": "pretty apex anonymous code", "filetypes": [".apex"], "cwd": "${fileDirname}", "inActive": true, "command": "prettier --parser=apex --write \"${file}\" --tab-width=4 --single-quote=true --apex-anonymous" }, ]