├── .vscodeignore
├── .vscode
├── settings.json
└── launch.json
├── images
└── logo.png
├── assets
├── apex-snippets.gif
├── lwc-js-snippets.gif
└── lwc-html-snippets.gif
├── CHANGELOG.md
├── .github
└── workflows
│ ├── dependencyReview.yml
│ └── publishExtension.yml
├── .gitignore
├── LICENSE
├── package.json
├── snippets
├── lwc-xml.json
├── lwc-html.json
├── lwc-js.json
└── apex.json
└── README.md
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | .vscode-test/**
3 | .gitignore
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "[jsonc]": {
3 | "editor.defaultFormatter": null
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets/HEAD/images/logo.png
--------------------------------------------------------------------------------
/assets/apex-snippets.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets/HEAD/assets/apex-snippets.gif
--------------------------------------------------------------------------------
/assets/lwc-js-snippets.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets/HEAD/assets/lwc-js-snippets.gif
--------------------------------------------------------------------------------
/assets/lwc-html-snippets.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets/HEAD/assets/lwc-html-snippets.gif
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to the "salesforce-snippets" extension will be documented in this file.
4 |
5 | ## [1.2.3]
6 |
7 | - Added more apex snippets and updated README
8 | ## [1.1.1]
9 |
10 | - Added more general description for LWC-XML in README
11 |
12 | ## [1.1.0]
13 |
14 | - Added XML snippets for LWC js-config files
15 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that launches the extension inside a new window
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | {
6 | "version": "0.2.0",
7 | "configurations": [
8 | {
9 | "name": "Extension",
10 | "type": "extensionHost",
11 | "request": "launch",
12 | "args": [
13 | "--extensionDevelopmentPath=${workspaceFolder}"
14 | ]
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/.github/workflows/dependencyReview.yml:
--------------------------------------------------------------------------------
1 | # Dependency Review Action
2 | #
3 | # This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
4 | #
5 | # Source repository: https://github.com/actions/dependency-review-action
6 | # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7 | name: 'Dependency Review'
8 | on: [pull_request]
9 |
10 | permissions:
11 | contents: read
12 |
13 | jobs:
14 | dependency-review:
15 | name: "Dependency reviewer"
16 | runs-on: ubuntu-latest
17 | steps:
18 | - name: 'Checkout Repository'
19 | uses: actions/checkout@v3
20 | - name: 'Dependency Review'
21 | uses: actions/dependency-review-action@v2
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used for Git repositories to specify intentionally untracked files that Git should ignore.
2 | # If you are not using git, you can delete this file. For more information see: https://git-scm.com/docs/gitignore
3 | # For useful gitignore templates see: https://github.com/github/gitignore
4 |
5 | # IDE
6 | .idea/
7 | .project/
8 | .nx-cache
9 | .vscode/
10 |
11 |
12 | # Salesforce cache
13 | .sf/
14 | .sfdx/
15 | .localdevserver/
16 | deploy-options.json
17 |
18 | # CumulusCI
19 | .cci/
20 |
21 | # LWC VSCode autocomplete
22 | **/lwc/jsconfig.json
23 |
24 | # LWC Jest coverage reports
25 | coverage/
26 |
27 | # Logs
28 | logs
29 | *.log
30 | npm-debug.log*
31 | yarn-debug.log*
32 | yarn-error.log*
33 | -local-*
34 |
35 | # Dependency directories
36 | node_modules/
37 | package-lock.json
38 |
39 | # Eslint cache
40 | .eslintcache
41 |
42 | # MacOS system files
43 | .DS_Store
44 |
45 | # Windows system files
46 | Thumbs.db
47 | ehthumbs.db
48 | [Dd]esktop.ini
49 | $RECYCLE.BIN/
50 |
51 | # Local environment variables
52 | .env
53 |
54 | # SOQL Query Results
55 | **/scripts/soql/query-results
56 |
57 | #Private keys
58 | *.key
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Beyond The Cloud Dev
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "salesforce-snippets-beyondthecloud",
3 | "displayName": "Salesforce Snippets",
4 | "description": "Snippets for Salesforce Apex and LWC",
5 | "icon": "images/logo.png",
6 | "version": "1.10.9",
7 | "publisher": "BeyondTheCloud",
8 | "repository": "https://github.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets",
9 | "engines": {
10 | "vscode": "^1.0.0"
11 | },
12 | "scripts": {
13 | "deploy": "vsce publish",
14 | "deploy-patch": "vsce publish patch",
15 | "deploy-minor": "vsce publish minor",
16 | "deploy-major": "vsce publish major"
17 | },
18 | "categories": [
19 | "Snippets"
20 | ],
21 | "keywords": [
22 | "snippets",
23 | "salesforce",
24 | "apex",
25 | "lwc",
26 | "lightning components"
27 | ],
28 | "badges": [
29 | {
30 | "description": "Visual Studio Marketplace Installs",
31 | "url": "https://img.shields.io/visual-studio-marketplace/i/BeyondTheCloud.salesforce-snippets-beyondthecloud?color=darkgreen",
32 | "href": "https://marketplace.visualstudio.com/items?itemName=BeyondTheCloud.salesforce-snippets-beyondthecloud"
33 | },
34 | {
35 | "description": "Stars",
36 | "url": "https://badgen.net/github/stars/beyond-the-cloud-dev/vsc-salesforce-code-snippets",
37 | "href": "https://github.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets/stargazers"
38 | },
39 | {
40 | "description": "LastCommit",
41 | "url": "https://img.shields.io/github/last-commit/beyond-the-cloud-dev/vsc-salesforce-code-snippets",
42 | "href": "https://github.com/beyond-the-cloud-dev/vsc-salesforce-code-snippets"
43 | },
44 | {
45 | "description": "Apex",
46 | "url": "https://img.shields.io/badge/Apex-67-green?style=flat-square",
47 | "href": "#apex"
48 | },
49 | {
50 | "description": "LWC-HTML",
51 | "url": "https://img.shields.io/badge/LWC_HTML-13-yellow?style=flat-square",
52 | "href": "#html"
53 | },
54 | {
55 | "description": "LWC-JS",
56 | "url": "https://img.shields.io/badge/LWC_JavaScript-33-blue?style=flat-square",
57 | "href": "#js"
58 | },
59 | {
60 | "description": "LWC-XML",
61 | "url": "https://img.shields.io/badge/LWC_XML-6-red?style=flat-square",
62 | "href": "#xml"
63 | }
64 | ],
65 | "contributes": {
66 | "snippets": [
67 | {
68 | "language": "apex",
69 | "path": "./snippets/apex.json"
70 | },
71 | {
72 | "language": "html",
73 | "path": "./snippets/lwc-html.json"
74 | },
75 | {
76 | "language": "javascript",
77 | "path": "./snippets/lwc-js.json"
78 | },
79 | {
80 | "language": "xml",
81 | "path": "./snippets/lwc-xml.json"
82 | }
83 | ]
84 | },
85 | "devDependencies": {
86 | "vsce": "^2.11.0"
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/snippets/lwc-xml.json:
--------------------------------------------------------------------------------
1 | {
2 | "LWC Capability": {
3 | "body": [
4 | "${1|lightningCommunity__RelaxedCSP,lightning__ServiceCloudVoiceToolkitApi|}"
5 | ],
6 | "description": "Capability",
7 | "prefix": [
8 | "capability"
9 | ],
10 | "scope": "xml"
11 | },
12 | "LWC Is Exposed": {
13 | "body": [
14 | "${1|true,false|}"
15 | ],
16 | "description": "Is Exposed",
17 | "prefix": [
18 | "isExposed"
19 | ],
20 | "scope": "xml"
21 | },
22 | "LWC masterLabel": {
23 | "body": [
24 | "${1:titleOfTheComponent}"
25 | ],
26 | "description": "masterLabel",
27 | "prefix": [
28 | "masterLabel"
29 | ],
30 | "scope": "xml"
31 | },
32 | "LWC Property Type": {
33 | "body": [
34 | "$0"
41 | ],
42 | "description": "Property Type",
43 | "prefix": [
44 | "propertyType"
45 | ],
46 | "scope": "xml"
47 | },
48 | "LWC Target Config": {
49 | "body": [
50 | "",
51 | "\t$0",
58 | ""
59 | ],
60 | "description": "Target Config",
61 | "prefix": [
62 | "targetConfig"
63 | ],
64 | "scope": "xml"
65 | },
66 | "LWC Targets": {
67 | "body": [
68 | "",
69 | "\t${1|lightning__AppPage,lightning__FlowScreen,lightning__HomePage,lightning__Inbox,lightning__RecordAction,lightning__RecordPage,lightning__Tab,lightning__UtilityBar,lightningCommunity__Default,lightningCommunity__Page,lightningCommunity__Page_Layout,lightningCommunity__Theme_Layout,lightningSnapin__ChatHeader,lightningSnapin__ChatMessage,lightningSnapin__Minimized,lightningSnapin__PreChat,lightningStatic__Email,analytics__Dashboard|}",
70 | ""
71 | ],
72 | "description": "Targets",
73 | "prefix": [
74 | "targets"
75 | ],
76 | "scope": "xml"
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/.github/workflows/publishExtension.yml:
--------------------------------------------------------------------------------
1 | name: 'VS Code Publisher'
2 |
3 | on:
4 | push:
5 | branches: [ "main" ]
6 | paths-ignore:
7 | - "package.json"
8 | - "CHANGELOG.md"
9 |
10 | workflow_dispatch:
11 |
12 | jobs:
13 | bump-version:
14 | name: 'Bump version on main'
15 | outputs:
16 | new-version: ${{ steps.version-bump.outputs.newTag }}
17 | runs-on: ubuntu-latest
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v3
21 | - name: Set Git Config
22 | run: |
23 | git config --global user.email "contact@beyondthecloud.dev"
24 | git config --global user.name "Beyond The Cloud"
25 | - name: 'Automated Version Bump'
26 | id: version-bump
27 | uses: 'phips28/gh-action-bump-version@master'
28 | with:
29 | tag-prefix: 'v'
30 | env:
31 | GITHUB_TOKEN: ${{ secrets.BUMP_VERSION_SECRET }}
32 | - name: 'Output Step'
33 | run: echo "NEW_TAG=${{ steps.version-bump.outputs.newTag }}" >> $GITHUB_OUTPUT
34 |
35 | publisher:
36 | needs: ['bump-version']
37 | name: "Publish Extension"
38 | runs-on: ubuntu-latest
39 | steps:
40 | - name: Checkout
41 | uses: actions/checkout@v3
42 | with:
43 | ref: 'main'
44 | fetch-depth: 0
45 | - name: Install Node.js
46 | uses: actions/setup-node@v3
47 | with:
48 | node-version: 16.x
49 | - run: npm install
50 | - name: Set Git Config
51 | run: |
52 | git config --global user.email "contact@beyondthecloud.dev"
53 | git config --global user.name "Beyond The Cloud"
54 | - name: Publish
55 | if: success()
56 | run: npm run deploy
57 | env:
58 | VSCE_PAT: ${{ secrets.VSCE_PAT }}
59 |
60 | release-builder:
61 | needs: ['bump-version','publisher']
62 | name: "Create Release"
63 | runs-on: "ubuntu-latest"
64 | permissions:
65 | contents: write
66 | steps:
67 | - name: Checkout
68 | uses: actions/checkout@v3
69 | with:
70 | ref: 'main'
71 | fetch-depth: 0
72 | - name: Build Changelog
73 | id: github_release
74 | uses: mikepenz/release-changelog-builder-action@v3
75 | env:
76 | GITHUB_TOKEN: ${{ secrets.BUMP_VERSION_SECRET }}
77 | with:
78 | configurationJson: |
79 | {
80 | "template": "Summary:\n\n#{{CHANGELOG}}\n\n#{{UNCATEGORIZED}}",
81 | "pr_template": "- #{{TITLE}}\n - PR: #{{URL}}\n - Description: #{{BODY}}",
82 | "empty_template": "- no changes",
83 | "categories": [
84 | {
85 | "title": "## 🚀 Features",
86 | "labels": ["feature"]
87 | },
88 | {
89 | "title": "## 💬 Other",
90 | "labels": ["other"]
91 | },
92 | {
93 | "title": "## 📦 Dependencies",
94 | "labels": ["dependencies"]
95 | }
96 | ],
97 | "sort": {
98 | "order": "ASC",
99 | "on_property": "mergedAt"
100 | }
101 | }
102 | - name: Create Github Release
103 | uses: ncipollo/release-action@v1
104 | with:
105 | artifacts: "README.md"
106 | body: ${{ steps.github_release.outputs.changelog }}
107 | token: ${{ secrets.BUMP_VERSION_SECRET }}
108 | tag: ${{ needs.bump-version.outputs.new-version }}
109 |
--------------------------------------------------------------------------------
/snippets/lwc-html.json:
--------------------------------------------------------------------------------
1 | {
2 | "LWC lightning-button": {
3 | "body": [
4 | "",
5 | ""
6 | ],
7 | "description": "lightning-button",
8 | "prefix": [
9 | "lightning-button"
10 | ],
11 | "scope": "html"
12 | },
13 | "LWC lightning-combobox": {
14 | "body": [
15 | ""
23 | ],
24 | "description": "lightning-combobox",
25 | "prefix": [
26 | "lightning-combobox"
27 | ],
28 | "scope": "html"
29 | },
30 | "LWC lightning-datatable": {
31 | "body": [
32 | ""
38 | ],
39 | "description": "lightning-datatable",
40 | "prefix": [
41 | "lightning-datatable"
42 | ],
43 | "scope": "html"
44 | },
45 | "LWC lightning-icon": {
46 | "body": [
47 | "",
48 | ""
49 | ],
50 | "description": "lightning-icon",
51 | "prefix": [
52 | "lightning-icon"
53 | ],
54 | "scope": "html"
55 | },
56 | "LWC lightning-input": {
57 | "body": [
58 | "",
59 | ""
60 | ],
61 | "description": "lightning-input",
62 | "prefix": [
63 | "lightning-input"
64 | ],
65 | "scope": "html"
66 | },
67 | "LWC lightning-input-field": {
68 | "body": [
69 | "",
70 | ""
71 | ],
72 | "description": "lightning-input-field ",
73 | "prefix": [
74 | "lightning-input-field "
75 | ],
76 | "scope": "html"
77 | },
78 | "LWC lightning-layout": {
79 | "body": [
80 | "",
81 | "\t",
82 | "\t",
83 | "\t",
84 | "\t",
85 | "\t",
86 | "\t",
87 | ""
88 | ],
89 | "description": "lightning-layout",
90 | "prefix": [
91 | "lightning-layout"
92 | ],
93 | "scope": "html"
94 | },
95 | "LWC lightning-layout-item": {
96 | "body": [
97 | "",
98 | ""
99 | ],
100 | "description": "lightning-layout-item",
101 | "prefix": [
102 | "lightning-layout-item"
103 | ],
104 | "scope": "html"
105 | },
106 | "LWC lightning-spinner": {
107 | "body": [
108 | "",
109 | ""
110 | ],
111 | "description": "lightning-spinner",
112 | "prefix": [
113 | "lightning-spinner"
114 | ],
115 | "scope": "html"
116 | },
117 | "LWC lightning-tabset": {
118 | "body": [
119 | "",
120 | "\t",
121 | "\t\t One Content !",
122 | "\t",
123 | "\t",
124 | "\t\t Two Content !",
125 | "\t",
126 | "\t",
127 | "\t\t Three Content !",
128 | "\t",
129 | ""
130 | ],
131 | "description": "lightning-tabset",
132 | "prefix": [
133 | "lightning-tabset"
134 | ],
135 | "scope": "html"
136 | },
137 | "LWC slot": {
138 | "body": [
139 | "",
140 | ""
141 | ],
142 | "description": "slot",
143 | "prefix": [
144 | "slot"
145 | ],
146 | "scope": "html"
147 | },
148 | "LWC template for:each": {
149 | "body": [
150 | "",
151 | ""
152 | ],
153 | "description": "Template for:each.",
154 | "prefix": [
155 | "templateForEach"
156 | ],
157 | "scope": "html"
158 | },
159 | "LWC template if:false": {
160 | "body": [
161 | "",
162 | ""
163 | ],
164 | "description": "Template if:false.",
165 | "prefix": [
166 | "templateIfFalse"
167 | ],
168 | "scope": "html"
169 | },
170 | "LWC template if:true": {
171 | "body": [
172 | "",
173 | ""
174 | ],
175 | "description": "Template if:true.",
176 | "prefix": [
177 | "templateIfTrue"
178 | ],
179 | "scope": "html"
180 | },
181 | "LWC template iterator:it": {
182 | "body": [
183 | "",
184 | "\t",
185 | "\t
",
186 | "\t{it.value.Name}",
187 | "\t
",
188 | "\t
",
189 | ""
190 | ],
191 | "description": "Template iterator:it.",
192 | "prefix": [
193 | "templateIteratorIt"
194 | ],
195 | "scope": "html"
196 | }
197 | }
198 |
--------------------------------------------------------------------------------
/snippets/lwc-js.json:
--------------------------------------------------------------------------------
1 | {
2 | "LWC Async/Await": {
3 | "body": [
4 | "try {",
5 | "\tconst result = await ${1:apexMethodName}({ apexMethodParams });",
6 | "} catch (error) {",
7 | "\tconsole.error(error)",
8 | "}"
9 | ],
10 | "description": "Then/Catch",
11 | "prefix": "asyncAwait",
12 | "scope": "javascript"
13 | },
14 | "LWC constructor": {
15 | "body": [
16 | "constructor() {",
17 | "\t$0",
18 | "}"
19 | ],
20 | "description": "constructor.",
21 | "prefix": "constructor",
22 | "scope": "javascript"
23 | },
24 | "LWC CurrentPageReference": {
25 | "body": [
26 | "import { CurrentPageReference } from 'lightning/navigation';",
27 | "@wire(CurrentPageReference)",
28 | "pageRef;"
29 | ],
30 | "description": "CurrentPageReference.",
31 | "prefix": "currentPageReference",
32 | "scope": "javascript"
33 | },
34 | "LWC CustomEvent": {
35 | "body": [
36 | "new CustomEvent('${1:eventName}', {",
37 | "\tdetail: ${2:details},",
38 | "\tbubbles: false,",
39 | "\tcomposed: false",
40 | "});"
41 | ],
42 | "description": "CustomEvent",
43 | "prefix": "customEvent",
44 | "scope": "javascript"
45 | },
46 | "LWC disconnectedCallback": {
47 | "body": [
48 | "disconnectedCallback() {",
49 | "",
50 | "}"
51 | ],
52 | "description": "disconnectedCallback.",
53 | "prefix": "disconnectedCallback",
54 | "scope": "javascript"
55 | },
56 | "LWC dispatchEvent": {
57 | "body": [
58 | "this.dispatchEvent(${1:customEvent});"
59 | ],
60 | "description": "dispatchEvent",
61 | "prefix": "dispatchEvent",
62 | "scope": "javascript"
63 | },
64 | "LWC ErrorCallback": {
65 | "body": [
66 | "errorCallback(error, stack) {",
67 | "\t",
68 | "}"
69 | ],
70 | "description": "errorCallback.",
71 | "prefix": "errorCallback",
72 | "scope": "javascript"
73 | },
74 | "LWC ForEach": {
75 | "body": [
76 | "${1:array}.forEach((item, index) => {",
77 | "\t$0",
78 | "});"
79 | ],
80 | "description": "The forEach() method executes a provided function once for each array element.",
81 | "prefix": "forEach",
82 | "scope": "javascript"
83 | },
84 | "LWC getObjectInfo": {
85 | "body": [
86 | "import { getObjectInfo } from 'lightning/uiObjectInfoApi';",
87 | "import ${1:objectName} from '@salesforce/schema/${2:objectApiName}';",
88 | "",
89 | "@wire(getObjectInfo, { objectApiName: ${1:objectName} })",
90 | "${3:propertyOrFunction};"
91 | ],
92 | "description": "getObjectInfo",
93 | "prefix": "getObjectInfo",
94 | "scope": "javascript"
95 | },
96 | "LWC getPicklistValues": {
97 | "body": [
98 | "import { getPicklistValues } from 'lightning/uiObjectInfoApi';",
99 | "import ${1:fieldName} from '@salesforce/schema/${2:objectApiName}.${3:fieldApiName}';",
100 | "",
101 | "@wire(getPicklistValues, { recordTypeId: '012000000000000AAA', fieldApiName: ${1:fieldName} })",
102 | "${4:propertyOrFunction};"
103 | ],
104 | "description": "getPicklistValues",
105 | "prefix": "getPicklistValues",
106 | "scope": "javascript"
107 | },
108 | "LWC getRecord": {
109 | "body": [
110 | "import { getRecord } from 'lightning/uiRecordApi';",
111 | "",
112 | "@wire(getRecord, { recordId: '${1:recordId}', fields: ${2:fields} })",
113 | "${3:propertyOrFunction};"
114 | ],
115 | "description": "getRecord",
116 | "prefix": "getRecord",
117 | "scope": "javascript"
118 | },
119 | "LWC getRecords": {
120 | "body": [
121 | "import { getRecords } from 'lightning/uiRecordApi';",
122 | "",
123 | "@wire(getRecords, { records: [ { recordIds: '${1:recordIds}', fields: ${2:fields} } ] })",
124 | "${3:propertyOrFunction};"
125 | ],
126 | "description": "getRecords",
127 | "prefix": "getRecords",
128 | "scope": "javascript"
129 | },
130 | "LWC Import Apex Method": {
131 | "body": [
132 | "import ${1:apexMethodName} from '@salesforce/apex/${2:Namespace}.${3:ClassName}.${4:apexMethodReference}';"
133 | ],
134 | "description": "Import apex method.",
135 | "prefix": "importApexMethod",
136 | "scope": "javascript"
137 | },
138 | "LWC Import Custom Label": {
139 | "body": [
140 | "import ${1:labelName} from '@salesforce/label/${2:labelReference}';"
141 | ],
142 | "description": "Import custom label.",
143 | "prefix": "importLabel",
144 | "scope": "javascript"
145 | },
146 | "LWC Import Field": {
147 | "body": [
148 | "import ${1:fieldName} from '@salesforce/schema/${2:objectApiName}.${3:fieldApiName}';"
149 | ],
150 | "description": "Import Field.",
151 | "prefix": "importField",
152 | "scope": "javascript"
153 | },
154 | "LWC Import Has Permission": {
155 | "body": [
156 | "import has${1:PermissionName} from '@salesforce/userPermission/${1:PermissionName}';"
157 | ],
158 | "description": "Import hasPermission.",
159 | "prefix": "importHasPermission",
160 | "scope": "javascript"
161 | },
162 | "LWC Import NavigationMixin": {
163 | "body": [
164 | "import { NavigationMixin } from 'lightning/navigation';"
165 | ],
166 | "description": "Import NavigationMixin.",
167 | "prefix": "importNavigationMixin",
168 | "scope": "javascript"
169 | },
170 | "LWC Import Object": {
171 | "body": [
172 | "import ${1:objectName} from '@salesforce/schema/${2:objectApiName}';"
173 | ],
174 | "description": "Import Object.",
175 | "prefix": "importObject",
176 | "scope": "javascript"
177 | },
178 | "LWC Import UserId": {
179 | "body": [
180 | "import userId from '@salesforce/user/Id';"
181 | ],
182 | "description": "Import UserId.",
183 | "prefix": "importUserId",
184 | "scope": "javascript"
185 | },
186 | "LWC Map": {
187 | "body": [
188 | "${1:array}.map((item, index) => {",
189 | "\treturn {",
190 | "\t\t$0",
191 | "\t}",
192 | "});"
193 | ],
194 | "description": "The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.",
195 | "prefix": "map",
196 | "scope": "javascript"
197 | },
198 | "LWC Message Channel": {
199 | "body": [
200 | "import ${1:channelName} from '@salesforce/messageChannel/${2:channelReference}';"
201 | ],
202 | "description": "Import message channel.",
203 | "prefix": "importMessageChannel",
204 | "scope": "javascript"
205 | },
206 | "LWC Navigate": {
207 | "body": [
208 | "this[NavigationMixin.Navigate]({",
209 | "\ttype: '${1|standard__app,comm__externalRecordPage,comm__externalRecordRelationshipPage,standard__component,standard__knowledgeArticlePage,comm__loginPage,standard__managedContentPage,comm__namedPage,standard__navItemPage,standard__objectPage,standard__recordPage,standard__recordRelationshipPage,standard__webPage|}',",
210 | "\tattributes: {",
211 | "\t\t$0 // Different per page type. ",
212 | "\t\t// Check documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_page_reference_type",
213 | "\t},",
214 | "\tstate: {",
215 | "\t\t$0 // Different per page type.",
216 | "\t}",
217 | "});"
218 | ],
219 | "description": "NavigationMixin.Navigate.",
220 | "prefix": "navigate",
221 | "scope": "javascript"
222 | },
223 | "LWC querySelector": {
224 | "body": [
225 | "this.template.querySelector('${1:element}');"
226 | ],
227 | "description": "querySelector",
228 | "prefix": "querySelector",
229 | "scope": "javascript"
230 | },
231 | "LWC querySelectorAll": {
232 | "body": [
233 | "this.template.querySelectorAll('${1:element}');"
234 | ],
235 | "description": "querySelectorAll",
236 | "prefix": "querySelectorAll",
237 | "scope": "javascript"
238 | },
239 | "LWC refreshApex": {
240 | "body": [
241 | "import { refreshApex } from '@salesforce/apex';"
242 | ],
243 | "description": "refreshApex.",
244 | "prefix": "importRefreshApex",
245 | "scope": "javascript"
246 | },
247 | "LWC render": {
248 | "body": [
249 | "render() {",
250 | "\t$0",
251 | "}"
252 | ],
253 | "description": "render.",
254 | "prefix": "render",
255 | "scope": "javascript"
256 | },
257 | "LWC renderedCallback": {
258 | "body": [
259 | "initialRender = true;",
260 | "renderedCallback() {",
261 | "\tif (!this.initialRender) {",
262 | "\t\treturn;",
263 | "\t}",
264 | "\t$0 // Your code here.",
265 | "\tthis.initialRender = false;",
266 | "}"
267 | ],
268 | "description": "renderedCallback.",
269 | "prefix": "renderedCallback",
270 | "scope": "javascript"
271 | },
272 | "LWC ShowToastEvent": {
273 | "body": [
274 | "import { ShowToastEvent } from 'lightning/platformShowToastEvent';",
275 | "new ShowToastEvent({ '${1:title}', '${2:message}', '${3:variant}' });"
276 | ],
277 | "description": "ShowToastEvent.",
278 | "prefix": "showToastEvent",
279 | "scope": "javascript"
280 | },
281 | "LWC Static Resource": {
282 | "body": [
283 | "import ${1:resourceName} from '@salesforce/resourceUrl/${2:resourceName}';"
284 | ],
285 | "description": "Import static resource.",
286 | "prefix": "importStaticResource",
287 | "scope": "javascript"
288 | },
289 | "LWC Then/Catch": {
290 | "body": [
291 | "${1:apexMethodName}({ apexMethodParams })",
292 | ".then(result => {",
293 | "\t",
294 | "})",
295 | ".catch(error => {",
296 | "\tconsole.error(error)",
297 | "});"
298 | ],
299 | "description": "Then/Catch",
300 | "prefix": "thenCatch",
301 | "scope": "javascript"
302 | },
303 | "LWC Wire Method": {
304 | "body": [
305 | "@wire(${1:apexMethodName}, { apexMethodParams })",
306 | "${5:wiredName}({ error, data }) {",
307 | "\tif (data) {",
308 | "\t\t$0",
309 | "\t} else if (error) {",
310 | "\t\tconsole.error(error);",
311 | "\t}",
312 | "}"
313 | ],
314 | "description": "wireMethod.",
315 | "prefix": "wireMethod",
316 | "scope": "javascript"
317 | },
318 | "LWC Wire Property": {
319 | "body": [
320 | "@wire(${1:apexMethodName}, { apexMethodParams })",
321 | "${5:property};"
322 | ],
323 | "description": "wireProperty.",
324 | "prefix": "wireProperty",
325 | "scope": "javascript"
326 | }
327 | }
328 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Salesforce Snippets
2 |
3 | A [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=BeyondTheCloud.salesforce-snippets-beyondthecloud) with Apex and LWC Snippets.
4 |
5 |
6 | [](https://marketplace.visualstudio.com/items?itemName=BeyondTheCloud.salesforce-snippets-beyondthecloud)
7 | []()
8 | []()
9 |
10 | ## List of Snippets
11 |
12 | **Extension contains 146 code snippets.**
13 |
14 | [](#apex)
15 | [](#html)
16 | [](#js)
17 | [](#xml)
18 |
19 | [Apex](#apex)
20 |
21 | - [AccessLevel](#accesslevel)
22 | - [AccessType](#accesstype)
23 | - [Assert](#assert-class)
24 | - [Database](#database-class)
25 | - [JSON](#json-class)
26 | - [String](#string-class)
27 | - [Test](#test-class)
28 | - [UserInfo](#userinfo-class)
29 | - [Other](#others)
30 |
31 | [LWC](#lwc)
32 |
33 | - [HTML](#html)
34 | - [JS](#js)
35 | - [XML](#xml)
36 |
37 | ### Apex example
38 |
39 |
40 |
41 |
42 | ### LWC JS example
43 |
44 |
45 |
46 |
47 | ### LWC HTML example
48 |
49 |
50 |
51 | ## Features
52 |
53 | # [Apex](./snippets/apex.json)
54 |
55 | ## [AccessLevel](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_AccessLevel.htm#apex_System_AccessLevel_properties)
56 |
57 |
58 |
59 | | Prefix |
60 | Example |
61 |
62 |
63 |
64 | | AccessLevelSystemMode |
65 |
66 |
67 | ```java
68 | AccessLevel.SYSTEM_MODE
69 | ```
70 |
71 | |
72 |
73 |
74 |
75 | | AccessLevelUserMode |
76 |
77 |
78 | ```java
79 | AccessLevel.USER_MODE
80 | ```
81 |
82 | |
83 |
84 |
85 |
86 |
87 | ## [AccessType](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_System_AccessType.htm)
88 |
89 |
90 |
91 | | Prefix |
92 | Example |
93 |
94 |
95 |
96 | | AccessTypeCreatable |
97 |
98 |
99 | ```java
100 | AccessType.CREATABLE
101 | ```
102 |
103 | |
104 |
105 |
106 |
107 | | AccessTypeReadable |
108 |
109 |
110 | ```java
111 | AccessType.READABLE
112 | ```
113 |
114 | |
115 |
116 |
117 |
118 | | AccessTypeUpdatable |
119 |
120 |
121 | ```java
122 | AccessType.UPDATABLE
123 | ```
124 |
125 | |
126 |
127 |
128 |
129 | | AccessTypeUpsertable |
130 |
131 |
132 | ```java
133 | AccessType.UPSERTABLE
134 | ```
135 |
136 | |
137 |
138 |
139 |
140 |
141 | ## [Assert Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_Assert.htm)
142 |
143 |
144 |
145 | | Prefix |
146 | Example |
147 |
148 |
149 |
150 | | assertAreEqual, Assert.areEqual, aae |
151 |
152 |
153 | ```java
154 | Assert.areEqual(1, 2, 'NOT EQUAL');
155 | ```
156 |
157 | |
158 |
159 |
160 |
161 | | assertAreNotEqual, Assert.areNotEqual, aane |
162 |
163 |
164 |
165 | ```java
166 | Assert.areNotEqual(1, 1, 'Your custom message here');
167 | ```
168 |
169 | |
170 |
171 |
172 |
173 | | assertFail, Assert.fail, af |
174 |
175 |
176 | ```java
177 | Assert.fail('Your custom message here');
178 | ```
179 |
180 | |
181 |
182 |
183 |
184 | | assertIsFalse, Assert.isFalse, aif |
185 |
186 |
187 | ```java
188 | Assert.isFalse(true, 'Your custom message here');
189 | ```
190 |
191 | |
192 |
193 |
194 |
195 | | assertIsInstanceOfType, Assert.isInstanceOfType, aii |
196 |
197 |
198 | ```java
199 | Assert.isInstanceOfType(new Account(), Contact.class, 'Your custom message here');
200 | ```
201 |
202 | |
203 |
204 |
205 |
206 | | assertIsNotInstanceOfType, Assert.isNotInstanceOfType, aini |
207 |
208 |
209 | ```java
210 | Assert.isNotInstanceOfType(new Account(), Account.class, 'Your custom message here');
211 | ```
212 |
213 | |
214 |
215 |
216 |
217 | | assertIsNotNull, Assert.isNotNull, ainn |
218 |
219 |
220 | ```java
221 | Assert.isNotNull(null, 'Your message here');
222 | ```
223 |
224 | |
225 |
226 |
227 |
228 | | assertIsNull, Assert.isNull, ain |
229 |
230 |
231 | ```java
232 | Assert.isNull(null, 'Your message here');
233 | ```
234 |
235 | |
236 |
237 |
238 |
239 | | assertIsTrue, Assert.isTrue, ait |
240 |
241 |
242 | ```java
243 | Assert.isTrue(null, 'Your message here');
244 | ```
245 |
246 | |
247 |
248 |
249 |
250 | ## [Database Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_database.htm#apex_System_Database_update_2)
251 |
252 |
253 |
254 | | Prefix |
255 | Example |
256 |
257 |
258 |
259 | | Database.countQuery |
260 |
261 |
262 | ```java
263 | Integer recordsAmount = Database.countQuery(queryString);
264 | ```
265 |
266 | |
267 |
268 |
269 |
270 | | Database.delete |
271 |
272 |
273 | ```java
274 | List deleteResults = Database.delete(recordsToDelete, allOrNone);
275 | ```
276 |
277 | |
278 |
279 |
280 |
281 | | Database.executeBatch, deb |
282 |
283 |
284 | ```java
285 | Id jobId = Database.executeBatch(new BatchLeadConvert(), 200);
286 | ```
287 |
288 | |
289 |
290 |
291 |
292 | | Database.insert |
293 |
294 |
295 | ```java
296 | List saveResults = Database.insert(recordsToInsert, allOrNone);
297 | ```
298 |
299 | |
300 |
301 |
302 |
303 | | Database.update |
304 |
305 |
306 | ```java
307 | List updateResults = Database.update(recordsToUpdate, allOrNone);
308 | ```
309 |
310 | |
311 |
312 |
313 |
314 | ## [JSON Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_Json.htm)
315 |
316 |
317 |
318 | | Prefix |
319 | Example |
320 |
321 |
322 |
323 | | JSON.deserialize |
324 |
325 |
326 | ```java
327 | ApexType result = (ApexType) JSON.deserialize(jsonString, ApexType.class);
328 | ```
329 |
330 | |
331 |
332 |
333 |
334 | | JSON.deserializeStrict |
335 |
336 |
337 | ```java
338 | ApexType result = (ApexType) JSON.deserializeStrict(jsonString, ApexType.class);
339 | ```
340 |
341 | |
342 |
343 |
344 |
345 | | JSON.serialize |
346 |
347 |
348 | ```java
349 | String serializedResult = JSON.serialize(objectToSerialize);
350 | ```
351 |
352 | |
353 |
354 |
355 |
356 | | JSON.serializePretty |
357 |
358 |
359 | ```java
360 | String serializedResult = JSON.serializePretty(objectToSerialize);
361 | ```
362 |
363 | |
364 |
365 |
366 |
367 |
368 | ## [String Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_System_String_join)
369 |
370 |
371 |
372 | | Prefix |
373 | Example |
374 |
375 |
376 |
377 | | String.escapeSingleQuotes |
378 |
379 |
380 | ```java
381 | String result = String.escapeSingleQuotes(stringToEscape);
382 | ```
383 |
384 | |
385 |
386 |
387 |
388 | | String.format |
389 |
390 |
391 | ```java
392 | String template = '{0} was last updated {1}';
393 | List |
398 |
399 |
400 |
401 | | String.isBlank |
402 |
403 |
404 | ```java
405 | String.isBlank(inputString)
406 | ```
407 |
408 | |
409 |
410 |
411 |
412 | | String.isNotBlank |
413 |
414 |
415 | ```java
416 | String.isNotBlank(inputString)
417 | ```
418 |
419 | |
420 |
421 |
422 |
423 | | String.isNotEmpty |
424 |
425 |
426 | ```java
427 | String.isNotEmpty(inputString)
428 | ```
429 |
430 | |
431 |
432 |
433 |
434 | | String.join |
435 |
436 |
437 | ```java
438 | String result = String.join(iterableObj, 'separator');
439 | ```
440 |
441 | |
442 |
443 |
444 |
445 | | String.valueOf |
446 |
447 |
448 | ```java
449 | String result = String.valueOf(valueToConvert);
450 | ```
451 |
452 | |
453 |
454 |
455 |
456 |
457 |
458 | ## [Test Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_test.htm)
459 |
460 |
461 |
462 | | Prefix |
463 | Example |
464 |
465 |
466 |
467 | | Test.calculatePermissionSetGroup |
468 |
469 |
470 | ```java
471 | Test.calculatePermissionSetGroup(permissionSetGroupId);
472 | ```
473 |
474 | |
475 |
476 |
477 |
478 | | Test.calculatePermissionSetGroups |
479 |
480 |
481 | ```java
482 | Test.calculatePermissionSetGroup(listOfPermissionSetGroupsIds);
483 | ```
484 |
485 | |
486 |
487 |
488 |
489 | | Test.clearApexPageMessages |
490 |
491 |
492 | ```java
493 | Test.clearApexPageMessages();
494 | ```
495 |
496 | |
497 |
498 |
499 |
500 | | Test.enableChangeDataCapture |
501 |
502 |
503 | ```java
504 | Test.enableChangeDataCapture();
505 | ```
506 |
507 | |
508 |
509 |
510 |
511 | | Test.getEventBus |
512 |
513 |
514 | ```java
515 | Test.getEventBus().deliver();
516 | ```
517 |
518 | |
519 |
520 |
521 |
522 | | Test.getStandardPricebookId |
523 |
524 |
525 | ```java
526 | Id pricebookId = Test.getStandardPricebookId();
527 | ```
528 |
529 | |
530 |
531 |
532 |
533 | | Test.isRunningTest |
534 |
535 |
536 | ```java
537 | Test.isRunningTest()
538 | ```
539 |
540 | |
541 |
542 |
543 |
544 | | Test.loadData |
545 |
546 |
547 | ```java
548 | List records = Test.loadData(ObjectApiName.SObjectType, 'staticResourceName');
549 | ```
550 |
551 | |
552 |
553 |
554 |
555 | | Test.setCurrentPage |
556 |
557 |
558 | ```java
559 | Test.setCurrentPage(pageReference);
560 | ```
561 |
562 | |
563 |
564 |
565 |
566 | | Test.setMock |
567 |
568 |
569 | ```java
570 | Test.setMock(HttpCalloutMock.class, new YourHttpCalloutMockImplementation());
571 | ```
572 |
573 | |
574 |
575 |
576 |
577 | | Test.startTest |
578 |
579 |
580 | ```java
581 | Test.startTest();
582 | ```
583 |
584 | |
585 |
586 |
587 |
588 | | Test.stopTest |
589 |
590 |
591 | ```java
592 | Test.stopTest();
593 | ```
594 |
595 | |
596 |
597 |
598 |
599 |
600 | ## [UserInfo Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_userinfo.htm)
601 |
602 |
603 |
604 | | Prefix |
605 | Example |
606 |
607 |
608 |
609 | | UserInfogetDefaultCurrency |
610 |
611 |
612 | ```java
613 | UserInfo.getDefaultCurrency();
614 | ```
615 |
616 | |
617 |
618 |
619 |
620 | | UserInfogetFirstName |
621 |
622 |
623 |
624 | ```java
625 | UserInfo.getFirstName();
626 | ```
627 |
628 | |
629 |
630 |
631 |
632 | | UserInfogetLanguage |
633 |
634 |
635 |
636 | ```java
637 | UserInfo.getLanguage();
638 | ```
639 |
640 | |
641 |
642 |
643 |
644 | | UserInfogetLastName |
645 |
646 |
647 |
648 | ```java
649 | UserInfo.getLastName();
650 | ```
651 |
652 | |
653 |
654 |
655 |
656 | | UserInfogetName |
657 |
658 |
659 |
660 | ```java
661 | UserInfo.getName();
662 | ```
663 |
664 | |
665 |
666 |
667 |
668 | | UserInfogetProfileId |
669 |
670 |
671 |
672 | ```java
673 | UserInfo.getProfileId();
674 | ```
675 |
676 | |
677 |
678 |
679 |
680 | | UserInfogetUserEmail |
681 |
682 |
683 |
684 | ```java
685 | UserInfo.getUserEmail();
686 | ```
687 |
688 | |
689 |
690 |
691 |
692 | | UserInfogetUserId |
693 |
694 |
695 |
696 | ```java
697 | UserInfo.getUserId();
698 | ```
699 |
700 | |
701 |
702 |
703 |
704 | | UserInfogetUserType |
705 |
706 |
707 |
708 | ```java
709 | UserInfo.getUserType();
710 | ```
711 |
712 | |
713 |
714 |
715 |
716 | ## Others
717 |
718 |
719 |
720 | | Prefix |
721 | Example |
722 |
723 |
724 |
725 |
726 |
727 | | forSoql, foro |
728 |
729 |
730 | ```java
731 | for (Type variable : [SELECT fieldsList FROM Type) {
732 | //Your code here
733 | }
734 | ```
735 |
736 | |
737 |
738 |
739 |
740 | | fori, itar |
741 |
742 |
743 | ```java
744 | for (Integer i = 0; i < listName.size(); i++) {
745 | Account acc = listName[i];
746 | // Your code here
747 | }
748 | ```
749 |
750 | |
751 |
752 |
753 |
754 | | forMap, itme |
755 |
756 |
757 | ```java
758 | for (Id accountId : mapName.keySet()) {
759 | Account acc = mapName.get(accountId);
760 | //Your code here
761 | }
762 | ```
763 |
764 | |
765 |
766 |
767 |
768 | | forReversedOrder, ritar |
769 |
770 |
771 | ```java
772 | for (Integer i = listName.size()-1; i >= 0; i--) {
773 | Account acc = listName[i];
774 | //Your code here
775 | }
776 | ```
777 |
778 | |
779 |
780 |
781 |
782 | | future |
783 |
784 |
785 | ```java
786 | @future
787 | public static void methodName() {
788 | //Your code here
789 | }
790 | ```
791 |
792 | |
793 |
794 |
795 |
796 | | if |
797 |
798 |
799 | ```java
800 | if (true) {
801 | //Your code here
802 | }
803 | ```
804 |
805 | |
806 |
807 |
808 |
809 | | ifElse, ife |
810 |
811 |
812 | ```java
813 | if(true) {
814 | //Your code here
815 | } else {
816 |
817 | }
818 | ```
819 |
820 | |
821 |
822 |
823 |
824 | | instanceOf, inst |
825 |
826 |
827 | ```java
828 | if (objects[0] instanceof Account) {
829 | Account acc = (Account) objects[0];
830 | }
831 | ```
832 |
833 | |
834 |
835 |
836 |
837 | | invocableMethod |
838 |
839 |
840 | ```java
841 | @InvocableMethod(label='YourLabeL' description='Description' category='Category')
842 | public static List exampleMethod() {
843 | //Your code here
844 | }
845 | ```
846 |
847 | |
848 |
849 |
850 |
851 | | isAssignableFrom |
852 |
853 |
854 | ```java
855 | ChildType.class.isAssignableFrom(SourceType.class);
856 | ```
857 |
858 | |
859 |
860 |
861 |
862 | | lastListElement, lst |
863 |
864 |
865 | ```java
866 | myList[myList.size() - 1]
867 | ```
868 |
869 | |
870 |
871 |
872 |
873 | | lazy |
874 |
875 |
876 | ```java
877 | if (myAccount == null) {
878 | myAccount = new Account();
879 | }
880 | ```
881 |
882 | |
883 |
884 |
885 |
886 | | list, nl |
887 |
888 |
889 | ```java
890 | List testAccounts = new List();
891 | ```
892 |
893 | |
894 |
895 |
896 |
897 | | map, nm |
898 |
899 |
900 | ```java
901 | Map testAccounts = new Map();
902 | ```
903 |
904 | |
905 |
906 |
907 |
908 | | set, ns |
909 |
910 |
911 | ```java
912 | Set accountIds = new Set();
913 | ```
914 |
915 | |
916 |
917 |
918 |
919 | | setOfIds, nsfl |
920 |
921 |
922 | ```java
923 | Set accountIds = new Map([SELECT Id FROM Account LIMIT 10]).keySet();
924 | ```
925 |
926 | |
927 |
928 |
929 |
930 | | mapFromList, nmfl |
931 |
932 |
933 | ```java
934 | Map myAccounts = new Map(accountsList);
935 | ```
936 |
937 | |
938 |
939 |
940 |
941 | | pro |
942 |
943 |
944 | ```java
945 | {get; private set;}
946 | ```
947 |
948 | |
949 |
950 |
951 |
952 | | prw |
953 |
954 |
955 | ```java
956 | {get; set;}
957 | ```
958 |
959 | |
960 |
961 |
962 |
963 | | final, psf |
964 |
965 |
966 | ```java
967 | public static final
968 | ```
969 |
970 | |
971 |
972 |
973 |
974 | | finalInteger, psfi |
975 |
976 |
977 | ```java
978 | public static final Integer
979 | ```
980 |
981 | |
982 |
983 |
984 |
985 | | finalString, psfs |
986 |
987 |
988 | ```java
989 | public static final String
990 | ```
991 |
992 | |
993 |
994 |
995 |
996 | | select, SEL |
997 |
998 |
999 | ```java
1000 | SELECT Id FROM Account
1001 | ```
1002 |
1003 | |
1004 |
1005 |
1006 |
1007 | | selectAll, SELALL |
1008 |
1009 |
1010 | ```java
1011 | SELECT FIELDS(ALL) FROM Account LIMIT 200
1012 | ```
1013 |
1014 | |
1015 |
1016 |
1017 |
1018 | | selectToMap, sqm |
1019 |
1020 |
1021 | ```java
1022 | Map myAccounts = new Map([SELECT Id FROM Account LIMIT 10]);
1023 | ```
1024 |
1025 | |
1026 |
1027 |
1028 |
1029 | | selectToList, sql |
1030 |
1031 |
1032 | ```java
1033 | List myAccounts = [SELECT Id, Name FROM Account];
1034 | ```
1035 |
1036 | |
1037 |
1038 |
1039 |
1040 | | selectToObject, sql1 |
1041 |
1042 |
1043 | ```java
1044 | List myAccounts = [SELECT Id FROM Account LIMIT 1];
1045 | Account myAcc = myAccounts.size() == 1 ? myAccounts.get(0) : null;
1046 | ```
1047 |
1048 | |
1049 |
1050 |
1051 |
1052 | | systemAssert, sa |
1053 |
1054 |
1055 | ```java
1056 | System.assert(condition, 'Your message here');
1057 | ```
1058 |
1059 | |
1060 |
1061 |
1062 |
1063 | | systemAssertEquals, sae |
1064 |
1065 |
1066 | ```java
1067 | System.assertEquals(expected, actual, 'Your message here');
1068 | ```
1069 |
1070 | |
1071 |
1072 |
1073 |
1074 | | systemAssertEquals, san |
1075 |
1076 |
1077 | ```java
1078 | System.assertEquals(null, actual, 'Your message here');
1079 | ```
1080 |
1081 | |
1082 |
1083 |
1084 |
1085 | | systemAssertFail, saf |
1086 |
1087 |
1088 | ```java
1089 | System.assert(false, 'Your message here');
1090 | ```
1091 |
1092 | |
1093 |
1094 |
1095 |
1096 | | systemAssertNotEquals, sane |
1097 |
1098 |
1099 | ```java
1100 | System.assertNotEquals(expected, actual, 'Your message here');
1101 | ```
1102 |
1103 | |
1104 |
1105 |
1106 |
1107 | | systemAssertNotEquals, sann |
1108 |
1109 |
1110 | ```java
1111 | System.assertNotEquals(null, 'Your message here');
1112 | ```
1113 |
1114 | |
1115 |
1116 |
1117 |
1118 | | systemDebug, sd |
1119 |
1120 |
1121 | ```java
1122 | System.debug(LoggingLevel.DEBUG, 'your message here: ' + variableHere);
1123 | ```
1124 |
1125 | |
1126 |
1127 |
1128 |
1129 | | systemDebugPretty, sdp |
1130 |
1131 |
1132 | ```java
1133 | System.debug(LoggingLevel.DEBUG, 'your message here: ' + JSON.SerializePretty(objectVariable));
1134 | ```
1135 |
1136 | |
1137 |
1138 |
1139 |
1140 | | systemRunAs, sra |
1141 |
1142 |
1143 | ```java
1144 | System.runAs(user) {
1145 | //your code here
1146 | }
1147 | ```
1148 |
1149 | |
1150 |
1151 |
1152 |
1153 | | isTest, tstm |
1154 |
1155 |
1156 | ```java
1157 | @IsTest
1158 | static void exampleName() {
1159 | //Your code here
1160 | Test.startTest();
1161 |
1162 | Test.stopTest();
1163 | }
1164 | ```
1165 |
1166 | |
1167 |
1168 |
1169 |
1170 | | testSetup, tsts |
1171 |
1172 |
1173 | ```java
1174 | @TestSetup
1175 | static void setup() {
1176 | //Your code here
1177 | }
1178 | ```
1179 |
1180 | |
1181 |
1182 |
1183 |
1184 | | throw, thr |
1185 |
1186 |
1187 | ```java
1188 | throw new CustomException();
1189 | ```
1190 |
1191 | |
1192 |
1193 |
1194 |
1195 | | tryCatch, tc |
1196 |
1197 |
1198 | ```java
1199 | try {
1200 | //Your code here
1201 | } catch (CustomException ex) {
1202 |
1203 | }
1204 | ```
1205 |
1206 | |
1207 |
1208 |
1209 |
1210 | | tryCatchFinally, tcf |
1211 |
1212 |
1213 | ```java
1214 | try {
1215 | //Your code here
1216 | } catch (CustomException ex) {
1217 |
1218 | } finally {
1219 |
1220 | }
1221 | ```
1222 |
1223 | |
1224 |
1225 |
1226 |
1227 | | while, wh |
1228 |
1229 |
1230 | ```java
1231 | while (condition) {
1232 | //Your code here
1233 | }
1234 | ```
1235 |
1236 | |
1237 |
1238 |
1239 |
1240 |
1241 | # LWC
1242 |
1243 | ## [HTML](./snippets/lwc-html.json)
1244 |
1245 |
1246 |
1247 | | Prefix |
1248 | Example |
1249 |
1250 |
1251 | | lightning-button |
1252 |
1253 |
1254 | ```html
1255 |
1256 |
1257 | ```
1258 |
1259 | |
1260 |
1261 |
1262 | | lightning-combobox |
1263 |
1264 |
1265 | ```html
1266 |
1274 | ```
1275 |
1276 | |
1277 |
1278 |
1279 | | lightning-datatable |
1280 |
1281 |
1282 | ```html
1283 |
1289 | ```
1290 |
1291 | |
1292 |
1293 |
1294 | | lightning-icon |
1295 |
1296 |
1297 | ```html
1298 |
1299 |
1300 | ```
1301 |
1302 | |
1303 |
1304 |
1305 | | lightning-input |
1306 |
1307 |
1308 | ```html
1309 |
1310 |
1311 | ```
1312 |
1313 | |
1314 |
1315 |
1316 | | lightning-input-field |
1317 |
1318 |
1319 | ```html
1320 |
1321 |
1322 | ```
1323 |
1324 | |
1325 |
1326 |
1327 | | lightning-layout |
1328 |
1329 |
1330 | ```html
1331 |
1332 |
1333 |
1334 |
1335 |
1336 |
1337 |
1338 |
1339 | ```
1340 |
1341 | |
1342 |
1343 |
1344 | | lightning-layout-item |
1345 |
1346 |
1347 | ```html
1348 |
1349 |
1350 | ```
1351 |
1352 | |
1353 |
1354 |
1355 | | lightning-tabset |
1356 |
1357 |
1358 | ```html
1359 |
1360 |
1361 | One Content !
1362 |
1363 |
1364 | Two Content !
1365 |
1366 |
1367 | Three Content !
1368 |
1369 |
1370 | ```
1371 |
1372 | |
1373 |
1374 |
1375 |
1376 | | lightning-tabset |
1377 |
1378 |
1379 | ```html
1380 |
1381 |
1382 | ```
1383 |
1384 | |
1385 |
1386 |
1387 | | slot |
1388 |
1389 |
1390 | ```html
1391 |
1392 |
1393 | ```
1394 |
1395 | |
1396 |
1397 |
1398 | | templateForEach |
1399 |
1400 |
1401 | ```html
1402 |
1403 |
1404 | ```
1405 |
1406 | |
1407 |
1408 |
1409 | | templateIfFalse |
1410 |
1411 |
1412 | ```html
1413 |
1414 |
1415 | ```
1416 |
1417 | |
1418 |
1419 |
1420 | | templateIfTrue |
1421 |
1422 |
1423 | ```html
1424 |
1425 |
1426 | ```
1427 |
1428 | |
1429 |
1430 |
1431 | | templateIteratorIt |
1432 |
1433 |
1434 | ```html
1435 |
1436 |
1437 |
1438 | {it.value.Name}
1439 |
1440 |
1441 |
1442 | ```
1443 |
1444 | |
1445 |
1446 |
1447 |
1448 | ## [JS](./snippets/lwc-js.json)
1449 |
1450 |
1451 |
1452 | | Prefix |
1453 | Example |
1454 |
1455 |
1456 | | asyncAwait |
1457 |
1458 |
1459 | ```js
1460 | try {
1461 | const result = await apexMethodName({ apexMethodParams });
1462 | } catch (error) {
1463 | console.error(error)
1464 | }
1465 | ```
1466 |
1467 | |
1468 |
1469 |
1470 | | constructor |
1471 |
1472 |
1473 | ```js
1474 | constructor() {
1475 |
1476 | }
1477 | ```
1478 |
1479 | |
1480 |
1481 |
1482 | | currentPageReference |
1483 |
1484 |
1485 | ```js
1486 | import { CurrentPageReference } from 'lightning/navigation';
1487 | @wire(CurrentPageReference)
1488 | pageRef;
1489 | ```
1490 |
1491 | |
1492 |
1493 |
1494 | | customEvent |
1495 |
1496 |
1497 | ```js
1498 | new CustomEvent('eventName', {
1499 | detail: details,
1500 | bubbles: false,
1501 | composed: false
1502 | });
1503 | ```
1504 |
1505 | |
1506 |
1507 |
1508 | | disconnectedCallback |
1509 |
1510 |
1511 | ```js
1512 | disconnectedCallback() {
1513 |
1514 | }
1515 | ```
1516 |
1517 | |
1518 |
1519 |
1520 | | dispatchEvent |
1521 |
1522 |
1523 | ```js
1524 | this.dispatchEvent(customEvent);
1525 | ```
1526 |
1527 | |
1528 |
1529 |
1530 | | errorCallback |
1531 |
1532 |
1533 | ```js
1534 | errorCallback(error, stack) {
1535 |
1536 | }
1537 | ```
1538 |
1539 | |
1540 |
1541 |
1542 | | forEach |
1543 |
1544 |
1545 | ```js
1546 | array.forEach((item, index) => {
1547 |
1548 | });
1549 | ```
1550 |
1551 | |
1552 |
1553 |
1554 | | getObjectInfo |
1555 |
1556 |
1557 | ```js
1558 | import { getObjectInfo } from 'lightning/uiObjectInfoApi';
1559 | import objectName from '@salesforce/schema/objectApiName';
1560 |
1561 | @wire(getObjectInfo, { objectApiName: objectName })
1562 | propertyOrFunction;
1563 | ```
1564 |
1565 | |
1566 |
1567 |
1568 | | getPicklistValues |
1569 |
1570 |
1571 | ```js
1572 | import { getPicklistValues } from 'lightning/uiObjectInfoApi';
1573 | import fieldName from '@salesforce/schema/objectApiName.fieldApiName';
1574 |
1575 | @wire(getPicklistValues, { recordTypeId: '012000000000000AAA', fieldApiName: fieldName })
1576 | propertyOrFunction;
1577 | ```
1578 |
1579 | |
1580 |
1581 |
1582 | | getRecord |
1583 |
1584 |
1585 | ```js
1586 | import { getRecord } from 'lightning/uiRecordApi';
1587 |
1588 | @wire(getRecord, { recordId: 'recordId', fields: fields })
1589 | propertyOrFunction;
1590 | ```
1591 |
1592 | |
1593 |
1594 |
1595 | | getRecords |
1596 |
1597 |
1598 | ```js
1599 | import { getRecords } from 'lightning/uiRecordApi';
1600 |
1601 | @wire(getRecords, { records: [ { recordIds: 'recordIds', fields: fields } ] })
1602 | propertyOrFunction;
1603 | ```
1604 |
1605 | |
1606 |
1607 |
1608 | | importApexMethod |
1609 |
1610 |
1611 | ```js
1612 | import apexMethodName from '@salesforce/apex/Namespace.ClassName.apexMethodReference';
1613 | ```
1614 |
1615 | |
1616 |
1617 |
1618 | | importField |
1619 |
1620 |
1621 | ```js
1622 | import fieldName from '@salesforce/schema/objectApiName.fieldApiName';
1623 | ```
1624 |
1625 | |
1626 |
1627 |
1628 | | importHasPermission |
1629 |
1630 |
1631 | ```js
1632 | import hasPermissionName from '@salesforce/userPermission/PermissionName';
1633 | ```
1634 |
1635 | |
1636 |
1637 |
1638 | | importNavigationMixin |
1639 |
1640 |
1641 | ```js
1642 | import { NavigationMixin } from 'lightning/navigation';
1643 | ```
1644 |
1645 | |
1646 |
1647 |
1648 | | importObject |
1649 |
1650 |
1651 | ```js
1652 | import objectName from '@salesforce/schema/objectApiName';
1653 | ```
1654 |
1655 | |
1656 |
1657 |
1658 | | importUserId |
1659 |
1660 |
1661 | ```js
1662 | import userId from '@salesforce/user/Id';
1663 | ```
1664 |
1665 | |
1666 |
1667 |
1668 | | map |
1669 |
1670 |
1671 | ```js
1672 | array.map((item, index) => {
1673 | return {
1674 |
1675 | }
1676 | });
1677 | ```
1678 |
1679 | |
1680 |
1681 |
1682 | | importMessageChannel |
1683 |
1684 |
1685 | ```js
1686 | import channelName from '@salesforce/messageChannel/channelReference';
1687 | ```
1688 |
1689 | |
1690 |
1691 |
1692 | | navigate |
1693 |
1694 |
1695 | ```js
1696 | this[NavigationMixin.Navigate]({
1697 | type: 'standard__app',
1698 | attributes: {
1699 | // Different per page type.
1700 | // Check documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_page_reference_type
1701 | },
1702 | state: {
1703 | // Different per page type.
1704 | }
1705 | });
1706 | ```
1707 |
1708 | |
1709 |
1710 |
1711 | | querySelector |
1712 |
1713 |
1714 | ```js
1715 | this.template.querySelector('element');
1716 | ```
1717 |
1718 | |
1719 |
1720 |
1721 | | querySelectorAll |
1722 |
1723 |
1724 | ```js
1725 | this.template.querySelectorAll('element');
1726 | ```
1727 |
1728 | |
1729 |
1730 |
1731 | | importRefreshApex |
1732 |
1733 |
1734 | ```js
1735 | import { refreshApex } from '@salesforce/apex';
1736 | ```
1737 |
1738 | |
1739 |
1740 |
1741 | | render |
1742 |
1743 |
1744 | ```js
1745 | render() {
1746 |
1747 | }
1748 | ```
1749 |
1750 | |
1751 |
1752 |
1753 | | renderedCallback |
1754 |
1755 |
1756 | ```js
1757 | initialRender = true;
1758 | renderedCallback() {
1759 | if (!this.initialRender) {
1760 | return;
1761 | }
1762 | // Your code here.
1763 | this.initialRender = false;
1764 | }
1765 | ```
1766 |
1767 | |
1768 |
1769 |
1770 | | showToastEvent |
1771 |
1772 |
1773 | ```js
1774 | import { ShowToastEvent } from 'lightning/platformShowToastEvent';
1775 | new ShowToastEvent({ 'title', 'message', 'variant' });
1776 | ```
1777 |
1778 | |
1779 |
1780 |
1781 | | importStaticResource |
1782 |
1783 |
1784 | ```js
1785 | import resourceName from '@salesforce/resourceUrl/resourceName';
1786 | ```
1787 |
1788 | |
1789 |
1790 |
1791 | | thenCatch |
1792 |
1793 |
1794 | ```js
1795 | apexMethodName({ apexMethodParams })
1796 | .then(result => {
1797 |
1798 | })
1799 | .catch(error => {
1800 | console.error(error)
1801 | });
1802 | ```
1803 |
1804 | |
1805 |
1806 |
1807 | | wireMethod |
1808 |
1809 |
1810 | ```js
1811 | @wire(apexMethodName, { apexMethodParams })
1812 | wiredName({ error, data }) {
1813 | if (data) {
1814 |
1815 | } else if (error) {
1816 | console.error(error);
1817 | }
1818 | }
1819 | ```
1820 |
1821 | |
1822 |
1823 |
1824 | | wireProperty |
1825 |
1826 |
1827 | ```js
1828 | @wire(apexMethodName, { apexMethodParams })
1829 | property;
1830 | ```
1831 |
1832 | |
1833 |
1834 |
1835 |
1836 | ## [XML](./snippets/lwc-xml.json)
1837 |
1838 |
1839 |
1840 | | Prefix |
1841 | Example |
1842 |
1843 |
1844 | | capability |
1845 |
1846 |
1847 | ```xml
1848 | lightningCommunity__RelaxedCSP
1849 | lightning__ServiceCloudVoiceToolkitApi
1850 | ```
1851 |
1852 | |
1853 |
1854 |
1855 | | isExposed |
1856 |
1857 |
1858 | ```xml
1859 | true
1860 | ```
1861 |
1862 | |
1863 |
1864 |
1865 | | masterLabel |
1866 |
1867 |
1868 | ```xml
1869 | titleOfTheComponent
1870 | ```
1871 |
1872 | |
1873 |
1874 |
1875 | | targets |
1876 |
1877 |
1878 | ```xml
1879 |
1880 | lightning__AppPage
1881 |
1882 | ```
1883 |
1884 | |
1885 | | targetConfig |
1886 |
1887 |
1888 | ```xml
1889 |
1890 |
1897 |
1898 | ```
1899 |
1900 | |
1901 |
1902 | | propertyType |
1903 |
1904 |
1905 | ```xml
1906 |
1913 | ```
1914 |
1915 | |
1916 |
1917 |
1918 |
--------------------------------------------------------------------------------
/snippets/apex.json:
--------------------------------------------------------------------------------
1 | {
2 | "AccessLevel.SYSTEM_MODE": {
3 | "body": [
4 | "AccessLevel.SYSTEM_MODE"
5 | ],
6 | "description": "AccessLevel.SYSTEM_MODE",
7 | "prefix": [
8 | "AccessLevelSystemMode"
9 | ],
10 | "scope": "apex,apex-anon"
11 | },
12 | "AccessLevel.USER_MODE": {
13 | "body": [
14 | "AccessLevel.USER_MODE"
15 | ],
16 | "description": "AccessLevel.USER_MODE",
17 | "prefix": [
18 | "AccessLevelUserMode"
19 | ],
20 | "scope": "apex,apex-anon"
21 | },
22 | "AccessType.CREATABLE": {
23 | "body": [
24 | "AccessType.CREATABLE"
25 | ],
26 | "description": "AccessType.CREATABLE",
27 | "prefix": [
28 | "AccessTypeCreatable"
29 | ],
30 | "scope": "apex,apex-anon"
31 | },
32 | "AccessType.READABLE": {
33 | "body": [
34 | "AccessType.READABLE"
35 | ],
36 | "description": "AccessType.READABLE",
37 | "prefix": [
38 | "AccessTypeReadable"
39 | ],
40 | "scope": "apex,apex-anon"
41 | },
42 | "AccessType.UPDATABLE": {
43 | "body": [
44 | "AccessType.UPDATABLE"
45 | ],
46 | "description": "AccessType.UPDATABLE",
47 | "prefix": [
48 | "AccessTypeUpdatable"
49 | ],
50 | "scope": "apex,apex-anon"
51 | },
52 | "AccessType.UPSERTABLE": {
53 | "body": [
54 | "AccessType.UPSERTABLE"
55 | ],
56 | "description": "AccessType.UPSERTABLE",
57 | "prefix": [
58 | "AccessTypeUpsertable"
59 | ],
60 | "scope": "apex,apex-anon"
61 | },
62 | "Assert Are Equals": {
63 | "body": [
64 | "Assert.areEqual(${1:expected}, ${2:actual}, ${3:message});",
65 | "$0"
66 | ],
67 | "description": "Assert equals condition in a test",
68 | "prefix": [
69 | "assertAreEqual",
70 | "Assert.areEqual",
71 | "aae"
72 | ],
73 | "scope": "apex,apex-anon"
74 | },
75 | "Assert Are Not Equals": {
76 | "body": [
77 | "Assert.areNotEqual(${1:expected}, ${2:actual}, ${3:message});",
78 | "$0"
79 | ],
80 | "description": "Assert not equals condition in a test",
81 | "prefix": [
82 | "assertAreNotEqual",
83 | "Assert.areNotEqual",
84 | "aane"
85 | ],
86 | "scope": "apex,apex-anon"
87 | },
88 | "Assert Fail": {
89 | "body": [
90 | "Assert.fail(${1:message});",
91 | "$0"
92 | ],
93 | "description": "Immediately return an error",
94 | "prefix": [
95 | "assertFail",
96 | "Assert.fail",
97 | "af"
98 | ],
99 | "scope": "apex,apex-anon"
100 | },
101 | "Assert Is False": {
102 | "body": [
103 | "Assert.isFalse(${1:condition}, ${2:message});",
104 | "$0"
105 | ],
106 | "description": "Asserts that the specified condition is false",
107 | "prefix": [
108 | "assertIsFalse",
109 | "Assert.isFalse",
110 | "aif"
111 | ],
112 | "scope": "apex,apex-anon"
113 | },
114 | "Assert Is Instance of type": {
115 | "body": [
116 | "Assert.isInstanceOfType(${1:ObjectInstance}, ${2:SystemType}, ${3:message});",
117 | "$0"
118 | ],
119 | "description": "Asserts that the instance is of the specified type",
120 | "prefix": [
121 | "assertIsInstanceOfType",
122 | "Assert.isInstanceOfType",
123 | "aii"
124 | ],
125 | "scope": "apex,apex-anon"
126 | },
127 | "Assert Is Not Instance of type": {
128 | "body": [
129 | "Assert.isNotInstanceOfType(${1:ObjectInstance}, ${2:SystemType}, ${3:message});",
130 | "$0"
131 | ],
132 | "description": "Asserts that the instance isn’t of the specified type",
133 | "prefix": [
134 | "assertIsNotInstanceOfType",
135 | "Assert.isNotInstanceOfType",
136 | "aini"
137 | ],
138 | "scope": "apex,apex-anon"
139 | },
140 | "Assert Is Not Null": {
141 | "body": [
142 | "Assert.isNotNull(${1:variable}, ${2:message});",
143 | "$0"
144 | ],
145 | "description": "Asserts that the value isn’t null.",
146 | "prefix": [
147 | "assertIsNotNull",
148 | "Assert.isNotNull",
149 | "ainn"
150 | ],
151 | "scope": "apex,apex-anon"
152 | },
153 | "Assert Is Null": {
154 | "body": [
155 | "Assert.isNull(${1:variable}, ${2:message});",
156 | "$0"
157 | ],
158 | "description": "Asserts that the value is null.",
159 | "prefix": [
160 | "assertIsNull",
161 | "Assert.isNull",
162 | "ain"
163 | ],
164 | "scope": "apex,apex-anon"
165 | },
166 | "Assert Is True": {
167 | "body": [
168 | "Assert.isTrue(${1:condition}, ${2:message});",
169 | "$0"
170 | ],
171 | "description": "Asserts that the specified condition is true",
172 | "prefix": [
173 | "assertIsTrue",
174 | "Assert.isTrue",
175 | "ait"
176 | ],
177 | "scope": "apex,apex-anon"
178 | },
179 | "Database Count Query": {
180 | "body": [
181 | "Integer ${1:recordsAmount} = Database.countQuery(${2:queryString})$0"
182 | ],
183 | "description": "eturns the number of records that a dynamic SOQL query.",
184 | "prefix": [
185 | "Database.countQuery"
186 | ],
187 | "scope": "apex,apex-anon"
188 | },
189 | "Database Delete": {
190 | "body": [
191 | "List ${1:deleteResults} = Database.delete(${2:recordsToDelete}, ${3:allOrNone});$0"
192 | ],
193 | "description": "Deletes a list of existing sObject records.",
194 | "prefix": [
195 | "Database.delete"
196 | ],
197 | "scope": "apex,apex-anon"
198 | },
199 | "Database Execute Batch": {
200 | "body": [
201 | "Id ${1:jobIdVariable} = Database.executeBatch(${2:batchInstance}, ${3:batchSize});$0"
202 | ],
203 | "description": "Execute a batch",
204 | "prefix": [
205 | "Database.executeBatch",
206 | "deb"
207 | ],
208 | "scope": "apex,apex-anon"
209 | },
210 | "Database Insert": {
211 | "body": [
212 | "List ${1:saveResults} = Database.insert(${2:recordsToInsert}, ${3:allOrNone});$0"
213 | ],
214 | "description": "Adds one or more sObjects.",
215 | "prefix": [
216 | "Database.insert"
217 | ],
218 | "scope": "apex,apex-anon"
219 | },
220 | "Database Update": {
221 | "body": [
222 | "List ${1:updateResults} = Database.update(${2:recordsToUpdate}, ${3:allOrNone});$0"
223 | ],
224 | "description": "Modifies one or more existing sObject records.",
225 | "prefix": [
226 | "Database.update"
227 | ],
228 | "scope": "apex,apex-anon"
229 | },
230 | "For loop for elements of an array": {
231 | "body": [
232 | "for (Integer ${1:loopVariable} = 0; ${1:loopVariable} < ${2:selectedArray}.size(); ${1:loopVariable}++) {",
233 | "\t${3:ArrayElementType} ${4:elementName} = ${2:selectedArray}[${1:loopVariable}];",
234 | "\t$0",
235 | "}"
236 | ],
237 | "description": "Create for loop for elements of an array",
238 | "prefix": [
239 | "fori",
240 | "itar"
241 | ],
242 | "scope": "apex,apex-anon"
243 | },
244 | "For loop for elements of an array in reversed order": {
245 | "body": [
246 | "for (Integer ${1:loopVariable} = ${2:selectedArray}.size()-1; ${1:loopVariable} >= 0; ${1:loopVariable}--) {",
247 | "\t${3:ArrayElementType} ${4:elementName} = ${2:selectedArray}[${1:loopVariable}];",
248 | "\t$0",
249 | "}"
250 | ],
251 | "description": "Create for loop for elements of an array in reversed order",
252 | "prefix": [
253 | "forReversedOrder",
254 | "ritar"
255 | ],
256 | "scope": "apex,apex-anon"
257 | },
258 | "For loop for entries of a Map": {
259 | "body": [
260 | "for (${1:SelectedMapKeyType} ${2:keyVariableName} : ${3:selectedMap}.keySet()) {",
261 | "\t${4:SelectedMapValueType} ${5:valueVariableName} = ${3:selectedMap}.get(${2:keyVariableName});",
262 | "\t$0",
263 | "}"
264 | ],
265 | "description": "Create for loop for entries of a Map",
266 | "prefix": [
267 | "forMap",
268 | "itme"
269 | ],
270 | "scope": "apex,apex-anon"
271 | },
272 | "For Loop for queried SObjects": {
273 | "body": [
274 | "for (${1:Type} ${2:variable} : [SELECT ${3:fieldsList} FROM ${1:Type}) {",
275 | "\t$0",
276 | "}"
277 | ],
278 | "description": "Create for loop for results of SOQL query",
279 | "prefix": [
280 | "forSoql",
281 | "foro"
282 | ],
283 | "scope": "apex,apex-anon"
284 | },
285 | "Future Method": {
286 | "body": [
287 | "@future",
288 | "public static void ${1:methodName}() {",
289 | "\t$0",
290 | "}"
291 | ],
292 | "description": "Future method.",
293 | "prefix": [
294 | "@future",
295 | "future"
296 | ],
297 | "scope": "apex,apex-anon"
298 | },
299 | "If": {
300 | "body": [
301 | "if(${1:condition}) {",
302 | "\t$0",
303 | "}"
304 | ],
305 | "description": "If statement",
306 | "prefix": "if",
307 | "scope": "apex,apex-anon"
308 | },
309 | "If Else": {
310 | "body": [
311 | "if(${1:condition}) {",
312 | "\t$0",
313 | "} else {",
314 | "\t",
315 | "}"
316 | ],
317 | "description": "If statement",
318 | "prefix": [
319 | "ifElse",
320 | "ife"
321 | ],
322 | "scope": "apex,apex-anon"
323 | },
324 | "Instance Of": {
325 | "body": [
326 | "if (${1:Variable} instanceof ${2:Type}) {",
327 | "\t${2:Type} ${3:castVariable} = (${2:Type}) ${1:Variable};",
328 | "\t$0",
329 | "}"
330 | ],
331 | "description": "Check instance of and downcast",
332 | "prefix": [
333 | "instanceOf",
334 | "inst"
335 | ],
336 | "scope": "apex,apex-anon"
337 | },
338 | "Invocable Method": {
339 | "body": [
340 | "@InvocableMethod(label='${1:Label}' description='${2:Description}' category='${3:Category}')",
341 | "public static List<${4:Type}> ${5:methodName}() {",
342 | "\t$0",
343 | "}"
344 | ],
345 | "description": "Invocable method.",
346 | "prefix": [
347 | "@InvocableMethod",
348 | "invocableMethod"
349 | ],
350 | "scope": "apex,apex-anon"
351 | },
352 | "Is Assignable": {
353 | "body": [
354 | "isAssignableFrom(${2:SourceType});"
355 | ],
356 | "description": "Check if Child Type is assignable from Source Type",
357 | "prefix": "isAssignableFrom",
358 | "scope": "apex,apex-anon"
359 | },
360 | "JSON Deserialize": {
361 | "body": [
362 | "${1:ApexType} ${2:result} = (${1:ApexType}) JSON.deserialize(${3:jsonString}, ${1:ApexType}.class);$0"
363 | ],
364 | "description": "Deserializes the specified JSON string into an Apex object of the specified type.",
365 | "prefix": [
366 | "JSON.deserialize"
367 | ],
368 | "scope": "apex,apex-anon"
369 | },
370 | "JSON Deserialize Strict": {
371 | "body": [
372 | "${1:ApexType} ${2:result} = (${1:ApexType}) JSON.deserializeStrict(${3:jsonString}, ${1:ApexType}.class);$0"
373 | ],
374 | "description": "Deserializes the specified JSON string into an Apex object of the specified type.",
375 | "prefix": [
376 | "JSON.deserializeStrict"
377 | ],
378 | "scope": "apex,apex-anon"
379 | },
380 | "JSON Serialize": {
381 | "body": [
382 | "String ${1:serializedResult} = JSON.serialize(${2:objectToSerialize});$0"
383 | ],
384 | "description": "Serializes Apex objects into JSON content.",
385 | "prefix": [
386 | "JSON.serialize"
387 | ],
388 | "scope": "apex,apex-anon"
389 | },
390 | "JSON Serialize Pretty": {
391 | "body": [
392 | "String ${1:serializedResult} = JSON.serializePretty(${2:objectToSerialize});$0"
393 | ],
394 | "description": "Serializes Apex objects into JSON content.",
395 | "prefix": [
396 | "JSON.serializePretty"
397 | ],
398 | "scope": "apex,apex-anon"
399 | },
400 | "Last element of list": {
401 | "body": [
402 | "${1:selectedList}[${1:selectedList}.size() - 1]$0"
403 | ],
404 | "description": "Get last element of list",
405 | "prefix": [
406 | "lastListElement",
407 | "lst"
408 | ],
409 | "scope": "apex,apex-anon"
410 | },
411 | "Lazy instantiation": {
412 | "body": [
413 | "if (${1:selectedVariable} == null) {",
414 | "\t${1:selectedVariable} = new ${2:SelectedVariableType}($0);",
415 | "}"
416 | ],
417 | "description": "Lazy instantiation",
418 | "prefix": "lazy",
419 | "scope": "apex,apex-anon"
420 | },
421 | "New List": {
422 | "body": [
423 | "List<${1:ElementType}> ${2:newListName} = new List<${1:ElementType}>();$0"
424 | ],
425 | "description": "Construct a new list and assign to a local variable",
426 | "prefix": [
427 | "list",
428 | "nl"
429 | ],
430 | "scope": "apex,apex-anon"
431 | },
432 | "New Map": {
433 | "body": [
434 | "Map<${1:KeyType}, ${2:ValueType}> ${3:newMapName} = new Map<${1:KeyType}, ${2:ValueType}>();$0"
435 | ],
436 | "description": "Construct a new map and assign to a local variable",
437 | "prefix": [
438 | "map",
439 | "nm"
440 | ],
441 | "scope": "apex,apex-anon"
442 | },
443 | "New Map from list of records": {
444 | "body": [
445 | "Map ${2:mapName} = new Map(${3:recordList});"
446 | ],
447 | "description": "Create map from list of records",
448 | "prefix": [
449 | "mapFromList",
450 | "nmfl"
451 | ],
452 | "scope": "apex,apex-anon"
453 | },
454 | "New Set": {
455 | "body": [
456 | "Set<${1:ElementType}> ${2:newSetName} = new Set<${1:ElementType}>();$0"
457 | ],
458 | "description": "Construct a new map and assign to a local variable",
459 | "prefix": [
460 | "set",
461 | "ns"
462 | ],
463 | "scope": "apex,apex-anon"
464 | },
465 | "New Set of Ids from list of records": {
466 | "body": [
467 | "Set ${1:setName} = new Map(${3:recordList}).keySet();"
468 | ],
469 | "description": "Create set of Ids from list of records",
470 | "prefix": [
471 | "setOfIds",
472 | "nsfl"
473 | ],
474 | "scope": "apex,apex-anon"
475 | },
476 | "Property Read Only": {
477 | "body": [
478 | "{get; private set;}"
479 | ],
480 | "description": "Create read-only property getter and setter",
481 | "prefix": [
482 | "{get; private set;}",
483 | "pro"
484 | ],
485 | "scope": "apex,apex-anon"
486 | },
487 | "Property Read Write": {
488 | "body": [
489 | "{get; set;}"
490 | ],
491 | "description": "Create read/write property getter and setter",
492 | "prefix": [
493 | "{get; set;}",
494 | "prw"
495 | ],
496 | "scope": "apex,apex-anon"
497 | },
498 | "Public Static Final": {
499 | "body": [
500 | "public static final"
501 | ],
502 | "description": "Begin declaration of a public static final field",
503 | "prefix": [
504 | "final",
505 | "psf"
506 | ],
507 | "scope": "apex,apex-anon"
508 | },
509 | "Public Static Final Integer": {
510 | "body": [
511 | "public static final Integer ${1:VARIABLE_NAME} = ${2:value};"
512 | ],
513 | "description": "Begin declaration of a public static final Integer field",
514 | "prefix": [
515 | "finalInteger",
516 | "psfi"
517 | ],
518 | "scope": "apex,apex-anon"
519 | },
520 | "Public Static Final String": {
521 | "body": [
522 | "public static final String ${1:VARIABLE_NAME} = ${2:value};"
523 | ],
524 | "description": "Begin declaration of a public static final String field",
525 | "prefix": [
526 | "finalString",
527 | "psfs"
528 | ],
529 | "scope": "apex,apex-anon"
530 | },
531 | "Select": {
532 | "body": [
533 | "SELECT ${2:FieldsList} FROM ${1:SObject}$0"
534 | ],
535 | "description": "Create a SOQL query",
536 | "prefix": [
537 | "select",
538 | "SEL"
539 | ],
540 | "scope": "apex,apex-anon"
541 | },
542 | "Select All Fields": {
543 | "body": [
544 | "SELECT FIELDS(ALL) FROM ${1:SObject}$0 LIMIT 200"
545 | ],
546 | "description": "Create a SOQL query with all fields",
547 | "prefix": [
548 | "selectAll",
549 | "SELALL"
550 | ],
551 | "scope": "apex,apex-anon"
552 | },
553 | "Select to list": {
554 | "body": [
555 | "List<${1:SObjectType}> ${2:variableName} = [SELECT ${3:fieldsList} FROM ${1:SObjectType}$0];"
556 | ],
557 | "description": "Create a SOQL query and assign result to list",
558 | "prefix": [
559 | "SelectToList",
560 | "sql"
561 | ],
562 | "scope": "apex,apex-anon"
563 | },
564 | "Select to list single record": {
565 | "body": [
566 | "List<${1:SObjectType}> ${2:variableName} = [SELECT ${3:fieldsList} FROM ${1:SObjectType}$4 LIMIT 1];",
567 | "${1:SObjectType} ${5:singleVariableName} = ${2:variableName}.size() == 1 ? ${2:variableName}.get(0) : null;$0"
568 | ],
569 | "description": "Create a SOQL query and assign result safely to list",
570 | "prefix": [
571 | "SelectToObject",
572 | "sql1"
573 | ],
574 | "scope": "apex,apex-anon"
575 | },
576 | "Select to map": {
577 | "body": [
578 | "Map ${2:variableName} = new Map([SELECT ${3:fieldsList} FROM ${1:SObjectType} $0]);"
579 | ],
580 | "description": "Create a SOQL query and assign result to map",
581 | "prefix": [
582 | "selectToMap",
583 | "sqm"
584 | ],
585 | "scope": "apex,apex-anon"
586 | },
587 | "String escapeSingleQuotes": {
588 | "body": [
589 | "String result = String.escapeSingleQuotes(${1:stringToEscape});"
590 | ],
591 | "description": "String.escapeSingleQuotes",
592 | "prefix": [
593 | "String.escapeSingleQuotes"
594 | ],
595 | "scope": "apex,apex-anon"
596 | },
597 | "String format": {
598 | "body": [
599 | "String template = '{0} was last updated {1}';",
600 | "List parameters = new List{ 'Universal Containers', DateTime.newInstance(2018, 11, 15) };",
601 | "String formatted = String.format(${1:template}, ${2:parameters});"
602 | ],
603 | "description": "String.format",
604 | "prefix": [
605 | "String.format"
606 | ],
607 | "scope": "apex,apex-anon"
608 | },
609 | "String isBlank": {
610 | "body": [
611 | "String.isBlank(${1:inputString})"
612 | ],
613 | "description": "String.isBlank",
614 | "prefix": [
615 | "String.isBlank"
616 | ],
617 | "scope": "apex,apex-anon"
618 | },
619 | "String isNotBlank": {
620 | "body": [
621 | "String.isNotBlank(${1:inputString})"
622 | ],
623 | "description": "String.isNotBlank",
624 | "prefix": [
625 | "String.isNotBlank"
626 | ],
627 | "scope": "apex,apex-anon"
628 | },
629 | "String isNotEmpty": {
630 | "body": [
631 | "String.isNotEmpty(${1:inputString})"
632 | ],
633 | "description": "String.isNotEmpty",
634 | "prefix": [
635 | "String.isNotEmpty"
636 | ],
637 | "scope": "apex,apex-anon"
638 | },
639 | "String join": {
640 | "body": [
641 | "String result = String.join(${1:iterableObj}, '${2:separator}');"
642 | ],
643 | "description": "String.join",
644 | "prefix": [
645 | "String.join"
646 | ],
647 | "scope": "apex,apex-anon"
648 | },
649 | "String valueOf": {
650 | "body": [
651 | "String result = String.valueOf(${1:valueToConvert});"
652 | ],
653 | "description": "String.valueOf",
654 | "prefix": [
655 | "String.valueOf"
656 | ],
657 | "scope": "apex,apex-anon"
658 | },
659 | "System Assert": {
660 | "body": [
661 | "System.assert(${1:expected}, ${2:message});"
662 | ],
663 | "description": "Assert a condition in a unit test",
664 | "prefix": [
665 | "systemAssert",
666 | "sa"
667 | ],
668 | "scope": "apex,apex-anon"
669 | },
670 | "System Assert Equals": {
671 | "body": [
672 | "System.assertEquals(${1:expected}, ${2:actual}, ${3:message});"
673 | ],
674 | "description": "Assert that a value is an expected value in a unit test",
675 | "prefix": [
676 | "systemAssertEquals",
677 | "sae"
678 | ],
679 | "scope": "apex,apex-anon"
680 | },
681 | "System Assert Equals Null": {
682 | "body": [
683 | "System.assertEquals(null, $0, ${1:message});"
684 | ],
685 | "description": "Assert that a value is null in a unit test",
686 | "prefix": [
687 | "systemAssertEquals",
688 | "san"
689 | ],
690 | "scope": "apex,apex-anon"
691 | },
692 | "System Assert Fail": {
693 | "body": [
694 | "System.assert(false, $0);"
695 | ],
696 | "description": "Fail unit test when this assert is reached",
697 | "prefix": [
698 | "systemAssertFail",
699 | "saf"
700 | ],
701 | "scope": "apex,apex-anon"
702 | },
703 | "System Assert Not Equals": {
704 | "body": [
705 | "System.assertNotEquals(${1:expected}, ${2:actual}, ${3:message});"
706 | ],
707 | "description": "Assert that a value is not an expected value in a unit test",
708 | "prefix": [
709 | "SystemAssertNotEquals",
710 | "sane"
711 | ],
712 | "scope": "apex,apex-anon"
713 | },
714 | "System Assert Not Equals Null": {
715 | "body": [
716 | "System.assertNotEquals(null, $0, ${1:message});"
717 | ],
718 | "description": "Assert that a value is not null in a unit test ",
719 | "prefix": [
720 | "systemAssertNotEqualsMessage",
721 | "sann"
722 | ],
723 | "scope": "apex,apex-anon"
724 | },
725 | "System Debug": {
726 | "body": [
727 | "System.debug(LoggingLevel.${1|DEBUG,ERROR,WARN,INFO,FINE,FINER,FINEST,NONE|}, '$2: ' + $0);"
728 | ],
729 | "description": "Debug",
730 | "prefix": [
731 | "systemDebug",
732 | "sd"
733 | ],
734 | "scope": "apex,apex-anon"
735 | },
736 | "System Debug Serialize Pretty": {
737 | "body": [
738 | "System.debug(LoggingLevel.${1|DEBUG,ERROR,WARN,INFO,FINE,FINER,FINEST,NONE|}, '$2: ' + JSON.SerializePretty($0));"
739 | ],
740 | "description": "Debug objects or collections",
741 | "prefix": [
742 | "systemDebugPretty",
743 | "sdp"
744 | ],
745 | "scope": "apex,apex-anon"
746 | },
747 | "System Run As": {
748 | "body": [
749 | "System.runAs(${1:user}) {",
750 | "\t$0",
751 | "}"
752 | ],
753 | "description": "System Run As User statement.",
754 | "prefix": [
755 | "systemRunAs",
756 | "sra"
757 | ],
758 | "scope": "apex,apex-anon"
759 | },
760 | "Test Method": {
761 | "body": [
762 | "@IsTest",
763 | "static void ${1:testMethodName}() {",
764 | "\t$0",
765 | "\tTest.startTest();",
766 | "\t",
767 | "\tTest.stopTest();",
768 | "}"
769 | ],
770 | "description": "Test setup for creating data before test methods run.",
771 | "prefix": [
772 | "@IsTest",
773 | "isTest",
774 | "tstm"
775 | ],
776 | "scope": "apex,apex-anon"
777 | },
778 | "Test.calculatePermissionSetGroup": {
779 | "body": [
780 | "Test.calculatePermissionSetGroup(${1:permissionSetGroupId});"
781 | ],
782 | "description": "Test.calculatePermissionSetGroup",
783 | "prefix": [
784 | "Test.calculatePermissionSetGroup"
785 | ],
786 | "scope": "apex,apex-anon"
787 | },
788 | "Test.calculatePermissionSetGroups": {
789 | "body": [
790 | "Test.calculatePermissionSetGroup(${1:listOfPermissionSetGroupsIds});"
791 | ],
792 | "description": "Test.calculatePermissionSetGroups",
793 | "prefix": [
794 | "Test.calculatePermissionSetGroups"
795 | ],
796 | "scope": "apex,apex-anon"
797 | },
798 | "Test.clearApexPageMessages": {
799 | "body": [
800 | "Test.clearApexPageMessages();"
801 | ],
802 | "description": "Test.clearApexPageMessages",
803 | "prefix": [
804 | "Test.clearApexPageMessages"
805 | ],
806 | "scope": "apex,apex-anon"
807 | },
808 | "Test.enableChangeDataCapture": {
809 | "body": [
810 | "Test.enableChangeDataCapture();"
811 | ],
812 | "description": "Test.enableChangeDataCapture",
813 | "prefix": [
814 | "Test.enableChangeDataCapture"
815 | ],
816 | "scope": "apex,apex-anon"
817 | },
818 | "Test.getEventBus": {
819 | "body": [
820 | "Test.getEventBus().deliver();"
821 | ],
822 | "description": "Test.getEventBus",
823 | "prefix": [
824 | "Test.getEventBus"
825 | ],
826 | "scope": "apex,apex-anon"
827 | },
828 | "Test.getStandardPricebookId": {
829 | "body": [
830 | "Id pricebookId = Test.getStandardPricebookId();"
831 | ],
832 | "description": "Test.getStandardPricebookId",
833 | "prefix": [
834 | "Test.getStandardPricebookId"
835 | ],
836 | "scope": "apex,apex-anon"
837 | },
838 | "Test.isRunningTest": {
839 | "body": [
840 | "Test.isRunningTest()"
841 | ],
842 | "description": "Test.isRunningTest",
843 | "prefix": [
844 | "Test.isRunningTest"
845 | ],
846 | "scope": "apex,apex-anon"
847 | },
848 | "Test.loadData": {
849 | "body": [
850 | "List records = Test.loadData(${1:ObjectApiName}.SObjectType, '${2:staticResourceName}');"
851 | ],
852 | "description": "Test.loadData",
853 | "prefix": [
854 | "Test.loadData"
855 | ],
856 | "scope": "apex,apex-anon"
857 | },
858 | "Test.setCurrentPage": {
859 | "body": [
860 | "Test.setCurrentPage(${1:pageReference});"
861 | ],
862 | "description": "Test.setCurrentPage",
863 | "prefix": [
864 | "Test.setCurrentPage"
865 | ],
866 | "scope": "apex,apex-anon"
867 | },
868 | "Test.setMock": {
869 | "body": [
870 | "Test.setMock(HttpCalloutMock.class, new ${1:YourHttpCalloutMockImplementation}());"
871 | ],
872 | "description": "Test.setMock",
873 | "prefix": [
874 | "Test.setMock"
875 | ],
876 | "scope": "apex,apex-anon"
877 | },
878 | "Test.startTest": {
879 | "body": [
880 | "Test.startTest();"
881 | ],
882 | "description": "Test.startTest",
883 | "prefix": [
884 | "Test.startTest"
885 | ],
886 | "scope": "apex,apex-anon"
887 | },
888 | "Test.stopTest": {
889 | "body": [
890 | "Test.stopTest();"
891 | ],
892 | "description": "Test.stopTest",
893 | "prefix": [
894 | "Test.stopTest"
895 | ],
896 | "scope": "apex,apex-anon"
897 | },
898 | "TestSetup": {
899 | "body": [
900 | "@TestSetup",
901 | "static void setup() {",
902 | "\t$0",
903 | "}"
904 | ],
905 | "description": "Test setup for creating data before test methods run.",
906 | "prefix": [
907 | "@TestSetup",
908 | "testSetup",
909 | "tsts"
910 | ],
911 | "scope": "apex,apex-anon"
912 | },
913 | "Throw exception": {
914 | "body": [
915 | "throw new ${1:exceptionType}($0);"
916 | ],
917 | "description": "Throw an exception",
918 | "prefix": [
919 | "throw",
920 | "thr"
921 | ],
922 | "scope": "apex,apex-anon"
923 | },
924 | "Try Catch": {
925 | "body": [
926 | "try {",
927 | "\t$0",
928 | "} catch (${1:exceptionType}) {",
929 | "\t",
930 | "}"
931 | ],
932 | "description": "Try Catch statement.",
933 | "prefix": [
934 | "tryCatch",
935 | "tc"
936 | ],
937 | "scope": "apex,apex-anon"
938 | },
939 | "Try Catch Finally": {
940 | "body": [
941 | "try {",
942 | "\t$0",
943 | "} catch (${1:exceptionType}) {",
944 | "\t",
945 | "} finally {",
946 | "\t",
947 | "}"
948 | ],
949 | "description": "Try Catch statement.",
950 | "prefix": [
951 | "tryCatchFinally",
952 | "tcf"
953 | ],
954 | "scope": "apex,apex-anon"
955 | },
956 | "UserInfo.getDefaultCurrency": {
957 | "body": [
958 | "UserInfo.getDefaultCurrency();"
959 | ],
960 | "description": "Get User default currency.",
961 | "prefix": [
962 | "UserInfogetDefaultCurrency"
963 | ],
964 | "scope": "apex,apex-anon"
965 | },
966 | "UserInfo.getFirstName": {
967 | "body": [
968 | "UserInfo.getFirstName();"
969 | ],
970 | "description": "Get User first name.",
971 | "prefix": [
972 | "UserInfogetFirstName"
973 | ],
974 | "scope": "apex,apex-anon"
975 | },
976 | "UserInfo.getLanguage": {
977 | "body": [
978 | "UserInfo.getLanguage();"
979 | ],
980 | "description": "Get User language.",
981 | "prefix": [
982 | "UserInfogetLanguage"
983 | ],
984 | "scope": "apex,apex-anon"
985 | },
986 | "UserInfo.getLastName": {
987 | "body": [
988 | "UserInfo.getLastName();"
989 | ],
990 | "description": "Get User last name.",
991 | "prefix": [
992 | "UserInfogetLastName"
993 | ],
994 | "scope": "apex,apex-anon"
995 | },
996 | "UserInfo.getName": {
997 | "body": [
998 | "UserInfo.getName();"
999 | ],
1000 | "description": "Get User name.",
1001 | "prefix": [
1002 | "UserInfogetName"
1003 | ],
1004 | "scope": "apex,apex-anon"
1005 | },
1006 | "UserInfo.getProfileId": {
1007 | "body": [
1008 | "UserInfo.getProfileId();"
1009 | ],
1010 | "description": "Get User profile id.",
1011 | "prefix": [
1012 | "UserInfogetProfileId"
1013 | ],
1014 | "scope": "apex,apex-anon"
1015 | },
1016 | "UserInfo.getUserEmail": {
1017 | "body": [
1018 | "UserInfo.getUserEmail();"
1019 | ],
1020 | "description": "Get User user email.",
1021 | "prefix": [
1022 | "UserInfogetUserEmail"
1023 | ],
1024 | "scope": "apex,apex-anon"
1025 | },
1026 | "UserInfo.getUserId": {
1027 | "body": [
1028 | "UserInfo.getUserId();"
1029 | ],
1030 | "description": "Get User user id.",
1031 | "prefix": [
1032 | "UserInfogetUserId"
1033 | ],
1034 | "scope": "apex,apex-anon"
1035 | },
1036 | "UserInfo.getUserType": {
1037 | "body": [
1038 | "UserInfo.getUserType();"
1039 | ],
1040 | "description": "Get User user type.",
1041 | "prefix": [
1042 | "UserInfogetUserType"
1043 | ],
1044 | "scope": "apex,apex-anon"
1045 | },
1046 | "While": {
1047 | "body": [
1048 | "while (${1:condition}) {",
1049 | "\t$0",
1050 | "}"
1051 | ],
1052 | "description": "While statement.",
1053 | "prefix": [
1054 | "while",
1055 | "wh"
1056 | ],
1057 | "scope": "apex,apex-anon"
1058 | }
1059 | }
1060 |
--------------------------------------------------------------------------------