Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Create New Custom LabelNew to Visual Studio Code? Get it now.
Create New Custom Label

Create New Custom Label

Keshav Ahlawat

|
53 installs
| (0) | Free
Create and manage Salesforce custom labels directly in VS Code with one click. Simplify your workflow effortlessly.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Create New Custom Label Extension

The "Create New Custom Label" extension for Visual Studio Code allows Salesforce developers to easily create custom labels directly from selected text within a Salesforce class. This extension streamlines the process of defining custom labels by automating the creation and insertion of label references.

Features

  • Supports JavaScript and Apex: Works seamlessly with both JavaScript (.js) and Apex (.cls) files.
  • Automatic Import Insertion: Automatically inserts the import statement for custom labels in JavaScript files.
  • Label Validation: Prevents duplicate labels from being created in CustomLabels.labels-meta.xml.
  • User-Friendly Prompts: Prompts for the label name and optional categories.

Requirements

  • Visual Studio Code
  • Salesforce Extension Pack (recommended)
  • A Salesforce DX project with the force-app/main/default/labels/CustomLabels.labels-meta.xml file present

Installation

You can install the extension from the Visual Studio Code Marketplace.

  1. Open Visual Studio Code
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on macOS)
  3. Search for "Create New Custom Label"
  4. Click Install

Usage

  1. In an Editor, select the text you want to convert to a custom label (must be enclosed in quotes)
  2. Right-click and choose "Create Custom Label" from the context menu
  3. Enter a name for your custom label
  4. Optionally enter categories for the label
  5. The extension will create the custom label and update your code

Example

In Apex Class File:

Before:

String message = 'Hello, World!';

After running the extension:

String message = System.Label.HelloWorld;

In JS File::

Before:

const some_awesome_variable = 'Some Amazing Text';

After running the extension:

import INCREDIBLY_FAST_LABEL_GEN from '@salesforce/label/c.INCREDIBLY_FAST_LABEL_GEN';

const some_awesome_variable = INCREDIBLY_FAST_LABEL_GEN;

Extension Settings

This extension does not contribute any additional settings.

Known Issues

  • If the CustomLabels.labels-meta.xml file is missing or corrupted, the extension may fail to create the custom label.

Release Notes

1.0.0

This release of the "Create New Custom Label" extension.

  • Initial release of the "Create New Custom Label" extension.
  • Added support for both JavaScript and Apex files.
  • Automatic insertion of import statements for custom labels in JavaScript files.
  • Validation to prevent duplicate label creation in CustomLabels.labels-meta.xml.

0.0.1

Initial release of the "Create New Custom Label" extension.

  • Create custom labels from selected text
  • Update CustomLabels.labels-meta.xml
  • Replace text with custom label reference
  • Support for optional categories

Contributing

If you find any issues or have suggestions for new features, feel free to open an issue or submit a pull request.


Working with Markdown

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

  • Split the editor (Cmd+\ on macOS or Ctrl+\ on Windows and Linux)
  • Toggle preview (Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux)
  • Press Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets

For more information:

  • Visual Studio Code's Markdown Support
  • Markdown Syntax Reference

Enjoy using the extension!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft