Are JavaScript buttons getting in the way of your move to Lightning Experience? The Lightning Experience Configuration Converter can help. With just a few clicks, this new tool scans your org for simple JavaScript buttons, converts them to point-and-click alternatives, and then deploys everything right to your org.

The Lightning Experience Configuration Converter recreates your org’s JavaScript buttons as Lightning components, quick actions, or other solutions — all without touching your original buttons. Before committing to any changes, you can preview the new component code or declarative steps and verify that the alternatives work as expected.

This tool currently converts some (but not all) JavaScript buttons that implement “url-hacks.” (If you’re not familiar with the term, a “url-hack” is how the community refers to a URL that sets predefined values.) This is the most common use case for JavaScript buttons. The Configuration Converter recreates these buttons as either quick actions, Lightning component actions, or custom buttons or links, based on what the JavaScript code is doing. JavaScript buttons can have varying degrees of complexity. Currently, the tool supports simpler “url-hack” implementations.

Example 1: Let’s look at a few examples of how the Configuration Converter can help Jennifer, a Salesforce developer at Ursa Major Solar, Inc., recreate the JavaScript buttons used in their org.

Ursa’s Salesforce implementation includes a custom JavaScript button that kicks off a Google search for “San Francisco.” The JavaScript for this button looks like this:

window.open("https://www.google.com/search?q=San%20Francisco")

When Jennifer uses the Configuration Converter to recreate this JavaScript button, the tool generates a new detail page button that is functionally equivalent and opens the same URL.

Example 2: Ursa’s implementation also includes a JavaScript button that uses a “url-hack” to edit a record and set a predefined value for a field. The JavaScript looks like this:

location.replace("/0016A00000MlPFl/e?00N6A00000IF4Mo=MyValue")

When Jennifer runs the Configuration Converter for this button, it creates a Lightning component action that opens a record for editing and sets the field with the ID of “00N6A00000IF4Mo” to “MyValue.”

To get started using the Configuration Converter:

  1. Visit the Lightning Experience Configuration Converter tool and log in with your sandbox or Developer Edition org credentials.
  2. Under Settings, list the objects that you want to scan for JavaScript buttons. For performance and manageability, we suggest you scan one object at a time.
  3. Click Refresh Buttons.
  4. Select Convert to recreate detected JavaScript buttons or Convert and Deploy to recreate detected JavaScript buttons and add the new Lightning alternatives to page layouts.
  5. Thoroughly test the changes before deploying to your production org.

This is just the start for the Configuration Converter. We’re looking at ways to extend the tool to help with additional customizations in your org. We look forward to your thoughts and feedback on the Lightning Experience Configuration Converter Trailblazer community group.

Resources

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS