Boost Salesforce Dev: GitHub Copilot AI Tool

The technology landscape witnessed a significant transformation on November 30th, 2022, with the introduction of the ChatGPT chatbot. This groundbreaking development has sent shockwaves through the technology industry, presenting the potential to render traditional search engines like Google obsolete. What sets ChatGPT apart is its remarkable ability to comprehend and respond to human language in a conversational manner, achieving an unprecedented level of accuracy.

Much like how computers revolutionized the world in the 1980s and the internet reshaped it in the 1990s, artificial intelligence is now leaving an indelible mark on our global landscape. This blog post serves as a testament to one such example, where AI is playing a pivotal role in aiding developers. GitHub Copilot, an AI tool, empowers developers by assisting them in writing code based on their intentions, marking a significant stride in the evolution of technology.

What is GitHub Copilot?


GitHub Copilot (GC) stands out as an AI-powered code completion tool, a collaborative assistant for developers analogous to a co-pilot in the cockpit. Developed collaboratively by GitHub and OpenAI, the same entity behind ChatGPT, GC was initially unveiled by GitHub on June 29, 2021. It transitioned into a subscription-based service for individual developers on June 22, 2022, and subsequently became available for Enterprise customers on December 8, 2022.

The remarkable aspect of this AI tool lies in its ability to generate code based on developers’ stated intents in comments. Users express their programming objectives, and GitHub Copilot responds by suggesting code snippets to accomplish those tasks. Once accepted, the suggested code seamlessly integrates into the code editor, allowing developers to further customize it to suit their specific requirements.

In my personal exploration of GC, I applied it to two Salesforce Apex Code use cases. The first scenario involved updating the addresses of all Contacts associated with an Account based on the Account’s address. The second, more intricate case employed Apex’s List, Set, and Map features to populate the WhoId on Task records based on Email Addresses.

In both instances, my coding speed increased significantly, conservatively estimated at three times faster with the assistance of GitHub Copilot. It’s worth noting that GitHub Copilot offers a 60-day free trial, with a subsequent subscription cost of US$10 per month or US$100 per year. For a more detailed demonstration, please refer to the accompanying video.

What I liked about GitHub Copilot?

1. Code suggestions were generated by interpreting plain English comments.

2. Ready-to-use code blocks were provided, significantly minimizing the time needed to manually type out code.

3. Accurate API names for standard Salesforce objects and fields were recommended, streamlining the coding process.

4. For custom objects and fields, ChatGPT proposed API names based on comments, even appending ‘__c’ as needed. When corrections were made to align with the actual API names in my Salesforce Org, the AI seamlessly adapted and consistently used the corrected names in subsequent code blocks. This adaptive feature was particularly impressive.

Concerns About GitHub Copilot

1. Although GitHub Copilot AI demonstrates remarkable accuracy in code generation, it is not infallible. Some tests revealed instances where it inserted an “update” statement within a loop, deviating from best practices. Consequently, it is essential to comprehend the generated code and potentially fine-tune it.

2. Code produced with GitHub Copilot may be subject to copyright if it integrates existing copyrighted code. Caution is advised when incorporating such code to avoid legal implications.

3. GitHub Copilot gathers user engagement data, potentially containing personal information. It is crucial to thoroughly understand the data collection practices, usage, and sharing policies before deciding to use it for professional purposes.

While it’s advisable to use GitHub Copilot for learning and experimentation purposes, it’s crucial to obtain approval from your organization or client before incorporating it into your professional work.

If you’re new to Apex, GitHub Copilot serves as an excellent tool for language acquisition. Simply by expressing your intended actions through comments, you can observe the suggested code blocks generated by the Copilot AI. For experienced developers, GitHub Copilot proves to be a valuable asset for accelerating code writing.

References & Useful URLs

For more details about Salesforce, visit us on www.thesalesforcemaster.com

Leave a Comment

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

Scroll to Top