What can I use ChatGPT for when working with Salesforce?

The year is coming to an end, but what a year it has been. As the news was announcing lockdowns to be over and events were starting, the world was in turmoil again when Russia began to invade Ukraine – putting the world on its head again.

Putting that aside (but not for too long), other big things have happened this year: Big strides in publically available AI tools. Although they have been around longer than this year, they have gotten quite a bit of attention as the ease of use has grown tremendously.

People generate images based on text descriptions and write articles by asking questions. …What?

Some concerns

In this article, I will mainly focus on ChatGPT. But other services might be mentioned for particular concerns.


For AI to work, it needs to be fed large amounts of information. And luckily for them, the internet is a vast resource of publicly available data. But what about copyright? Someone wrote that “data”, and maybe not everyone has given their consent to that data being ingested and used in such a way.

I am no lawyer or legislative specialist, and I will follow this news. But there are already lawsuits and concerns being outed everywhere.

Incorrect Information

We (hopefully) all know that the internet contains a lot of incorrect information. And that information has most likely also been fed to these AI. If you start asking questions to ChatGPT, heed the warnings it gives you!

Free (for now)

Going to keep this one short: “If something is free, you are the product.” Think about that one when entering information into these services.

What can we use it for?

With those concerns out of the way, we can get to some of the good stuff. What can we use these services for?

Making our lives a little bit easier, one step at a time.

Answer questions you have

One of the primary purposes these AI services are used for, is to answer questions. ChatGPT was trained on conversational content to explain things and respond in a “human tone”.

Do you have questions about a Salesforce product, chances are pretty high it will give you a correct answer. But again, keep in mind the warnings above!

Write Content

One of the great things about ChatGPT is that it writes very detailed explanations in a very short amount of time. This can speed up writing documentation and guides needed for certain features.

Write Code

I am getting into dangerous territory now, aren’t I? Yes, many articles have already been written about ChatGPT’s ability to write code. But as these articles point out, this new “option” is dangerous for Junior developers (and also senior devs).

There have been many occasions of ChatGPT providing good answers. But it has also pushed out insecure, bad performing, and bad practice code.

I also tried to get it to generate Salesforce B2C Commerce Cloud code, but since most of the code is not public, it tends to create Salesforce B2B examples or give generic answers. We use “Controllers” as the name for our server-side code, which is probably not helping our case with this AI.

Ok… let’s try that again?

Ok, that is not nearly close to what I meant. Let’s see how many attempts I need for a Salesforce Apex trigger.

That is more like it! There is much more public code available for the Salesforce platform than for B2C Commerce Cloud (Demandware). And that also explains why I need fewer attempts to get what I want.

But some things could be improved in the code it generated – Notice the insert of the single review inside a loop?

So again, USE WITH CARE! But you can ask the AI to correct itself:

Maybe formulating the questions in a specific manner will generate higher-quality responses. Perhaps something like this:

					Write a Salesforce apex trigger to download reviews from a third party when a product is saved, making use of best practices and avoiding governor limits


The future

It is exciting and scary how quickly the world of AI is evolving. We have gotten quite a few new toys this year to play with.

But what does 2023 have in store for us? How quickly will they evolve now that we have come to a point where data is so easily accessible and in large volumes?


These new AI tools make our lives easier, and the results it is pushing out are amazing to behold.

Learning how to use this tool will also take some time: The better you can formulate your questions or descriptions, the better the AI’s responses will get.
Speaking from personal experience, I have to rephrase my questions quite often to get a good result. Luckily, for now, the failed attempts are free. But for how long?

And on a final note, make sure to fact-check and optimize what has been generated. In many cases, the text or code generated needs some “refactoring” to be useful.

If there is one takeaway from the above article: “Don’t trust the info it gives you just yet. Use it as a starting point – but nothing more.”

Robot Writing Code - ChatGPT

Table of Contents