Skip to content
Book Your Free Consultation
(877) 595-3504

Exploring the Capabilities of ChatGPT in the Salesforce Ecosystem: A Look into its Successes and Failures

Everyone’s eyes are on Artificial Intelligence recently with the release of a multitude of AI products; The biggest one being ChatGPT. The question Salesforce professionals are asking is how does this affect the Salesforce ecosystem?

We ran some experiments internally to see how proficient ChatGPT is at doing Salesforce tasks. The answer is ChatGPT is not going to replace the need for Salesforce professionals anytime soon – However, it will become a tool to boost productivity and efficiency.

While ChatGPT will confidently answer your Salesforce question, it is often wrong and will not follow industry standards. Here are some examples of its successes and failures:

Prompt #1:

In Salesforce, Create a validation rule on the Opportunity Object to prevent users from changing the status from ‘Closed’ to ‘Open’. If the stage = ‘Closed Won’ or ‘Closed Lost’, prevent the user from changing the status unless it is a Salesforce Administrator.

 

We used the GPT 4 model and it provided this answer for us:

AND(

    OR(

        ISPICKVAL(PRIORVALUE(StageName), “Closed Won”),

        ISPICKVAL(PRIORVALUE(StageName), “Closed Lost”)

    ),

    NOT($Profile.Name = “System Administrator”)

)

This answer was pretty good! There are a few adjustments that could be made to make it better based on the Org, and this is where the Salesforce profession comes in. While ChatGPT was able to provide a decent answer, this validation rule will still need to be tested, validated, and deployed from a sandbox. ChatGPT is not able to do that – yet.

Now, something harder – Creating an apex trigger:

 

 

Prompt #2:

In Salesforce, I am trying to stamp the lead status when a lead is converted to the contact in a custom field called, “Lead Status”. Create a trigger that can do this.

GPT 4’s response:

trigger UpdateLeadStatusOnContactConversion on Contact (after update) {

    List<Lead> leadsToUpdate = new List<Lead>();

    for (Contact c : Trigger.new) {

        if (c.IsConverted && c.Converted_Lead_Id != null) {

            Lead convertedLead = [SELECT Id, Lead_Status__c FROM Lead WHERE Id = :c.Converted_Lead_Id];

            convertedLead.Lead_Status__c = ‘Converted’;

            leadsToUpdate.add(convertedLead);

        }

    }

    update leadsToUpdate;

}

 

This is where ChatGPT still has more to learn. On line 5, This apex trigger puts an apex query in a for loop. This is a big issue that if deployed would cause chaos in a salesforce instance because it could possibly cause a SOQL time out error everytime it runs. It also is stamping the Lead Status onto the lead object and not on the contact object. This is not what we wanted the AI to do.

Artificial Intelligence is a powerful tool and will continue to grow stronger. It is going to create many possibilities for the future. However, its Salesforce skills are not quite there with ChatGPT 4. While it can create solutions for simple business problems, it will struggle with more complex business logic.

With the upcoming release of Einstein GPT, we will continue to see AI improve especially since Einstein GPT will be fine tuned to work for Salesforce. However, it will simply be a tool to improve salesforce development. There will still be the need for a knowledgeable person to guide the AI in the right direction.