Skip to main content

Generative AI

Unlocking the Power of AI: Einstein for Developers

Artificial Intelligence Concept Brain With Cpu

“Einstein for Developers” refers to the set of artificial intelligence (AI) and machine learning (ML) tools and features available for developers within the Salesforce platform. Salesforce Einstein is designed to help Salesforce developers build smarter, more predictive, and more automated applications that enhance their CRM and business processes.

Einstein for Developers is a generative AI tool designed specifically for Salesforce code languages.  It is built using Salesforce’s global Code-Gen which is Salesforce’s open-source Large Language Module (LLM). Currently, the Einstein for Developers is available in “Beta”.

So, let’s go through a few easy steps.

How to Setup Einstein for Developers:

Step 1: Enable Einstein for Developers in org: –

The first step is to enable the “Einstein for Developers” option in the org.

  1. Go to the setup.
  2. Enter “Einstein for Developers” in the quick find box and select.
  3. Enable the “Einstein for Developers” option as shown below.

Img1

Step 2: Setup Einstein for Developers Extension: –

To set up the extension in the Visual Studio Code, follow the step-by-step process described below.

  1. Open the Visual Studio Code.
  2. Search “Einstein for Developers” in the extensions or you can directly press “Ctrl + Shift + X” and search for it.
  3. Install the extension as shown in the figure below.

Img2

Note: This is mandatory step for using Einstein for Developers in VS. Without this Einstein icon(in step 4) won’t be visible in your VS code project.

Step 3: Create a project:

  1. Open the command palette or press “Ctrl + Shift + P”.
  2. Select or type the command “SFDX: Create Project”.
  3. Select “Standard” and enter the Project name.
  4. Select the folder and press enter.

In this way, you’ve created the project in VS Code.

Step 4: Authorize an org:

  1. Open the command palette or press “Ctrl + Shift + P”.
  2. Select or type the command “SFDX: Authorize an org”.
  3. Select Project Default. (You can also choose other options according to the requirements.)
  4. Enter the org name or org alias and press enter.
  5. Enter the credentials and authorize your org.

In this way, you’ve authorized your org too.

If you’re already done with creating a project and authorizing the org, you can skip step 3 and step 4 respectively.

Once you are done with creating a project and authenticating an org, an Einstein icon will be visible as “Einstein Sidebar” on the left as shown in the figure below.

Img3

There are two ways to generate a code in the VS Code with the help of Einstein for Developer. Let’s go through both.

Note: The current capability of Einstein for Developer is to use only in “Apex”. After the upcoming releases, it will be possible to use Einstein Developer for LWC also.

Way 1: Generate code in the Einstein Sidebar Prompt –

You need to simply write instructions in the Einstein Sidebar prompt and click on the “Ask” button. It is similar to the ChatGPT.

Img4

You can see, we have provided the instructions in the prompt and clicked on “Ask”. Immediately, the “Einstein for Developer” extension generates the code for the user. Here, it is also provided with a “Like” and “Dislike” button below the answer to express the view or satisfaction of the user.

Note: What happens sometimes is that even if you provide instructions in the prompt, it fails to generate an answer. So that time, try to change the provided instructions or write it in a different manner. It’s a matter of “how well you write your prompt.”

Test Class:

Let’s write a test class for the above Apex class.

Img5

Way 2: Generate code using command palette –

The other way is to write the instructions in the command palette.

  1. Create an apex class or you can use the existing one. (Delete the class name and method name if the VS code is automatically generated for you.)
  2. Open the command palette and search “Einstein: Generate Code” as shown below.
    Img6
  3. Select “Einstein: Generate Code”.
  4. Write the instructions there for the Einstein extension.
  5. Press Enter.

It will generate the apex class for you. The answer consists of three options: Accept, Try Again, and Clear.

Note: Do not use this extension in your actual project unless you get permission. Else you can use it in your normal VS code projects in your pc.

Einstein: History & Feedback: –

There is a new tab added with the Einstein extension is “History & Feedback” to the terminal.

If you are not able to see it in the terminal window then open the command palette, search, and select “Einstein: Show Prompt History”.

Here you can see the previous results and codes. Also, there is an option for “like and dislike” and send your feedback.

Img7

 

Benefits of Einstein for Developers:

There are many benefits of Einstein for Developers. A few of them are listed below.

  1. Efficient Data Analysis
  2. Time-Saving Solutions
  3. Simplified Development
  4. Improved Decision-making
  5. Accessibility and Integration
  6. Developer-Friendly Resources

So, these were the benefits of Einstein for Developers. And we’ve seen how to work with Einstein extension in VS Code.

 

Conclusion:

Einstein for Developers introduces a new era in application development within the Salesforce ecosystem. In this blog, we’ve explored the immense potential of “Einstein for Developers” to generate the code for developers in VS Code. Explored it’s features and advantages also.

 

Related Articles:

  1. Salesforce Einstein Basics
  2. Einstein and Generative AI
  3. Artificial Intelligence Technology and Resources
  4. Salesforce Einstein Chatbot

Thoughts on “Unlocking the Power of AI: Einstein for Developers”

  1. We turn on the Einstien for developer for the dev and trail.

    We would like to turn on In production org, is there any pros and cons when we turn on in the production Org?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Abhinav Masane

Abhinav Masane is an Associate Technical Consultant at Perficient based in Nagpur. He is a Salesforce Certified Associate and Developer. Abhinav is always keen to learn and explore new technologies.

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram