5 Simple ChatGPT Prompts That Help Me Build Salesforce Solutions Faster

5 Simple ChatGPT Prompts That Help Me Build Salesforce Solutions Faster

Build things from scratch? Not anymore!

My Personal Experience

I've been using ChatGPT for my development needs for quite some time now.

What I've learned is that when you ask ChatGPT to generate anything, it may not produce the ideal code that meets all of your requirements. That's understandable given your requirement is unique.

However, 100% of the time, it does give you code that solves at least 50% of your requirements. This is great for generating boilerplate code. This means you don't have to build things from scratch; instead, you can take the code that's generated and build on top of it. Helping you save time, focus on solving more complex problems, and get things done faster.

This has been game-changing for me and I want to share them with you. Here are just a very few examples of how ChatGPT can help you build Salesforce solutions faster.

1️⃣ Apex Queries

🚀 Prompt

Apex query members of a specific community

Response

🚀 Few more Prompt examples

apex query custom metadata
apex query all networkids
apex query accounts belonging to a specific industry

2️⃣ Apex Methods

Use Case - Create a method that queries data and transforms it for other use

I have sample merge fields and their values stored in Custom Metadata. I need an Apex method that retrieves the info from Custom Metadata and formats it into the below format where the merge field is the key and the merge value is the value of the map item.

🚀 Prompt

apex create a method that queries the records 
from custom metadata with 2 fields Merge_Placeholder__c, Merge_Value__c. 
Create a string map where the key is Merge_Placeholder__c
and the value is Merge_Value__c

Response


3️⃣ LWCs

🚀 Prompt

create an lwc that shows the list of cases related to an account

Response

🚀 Try This Prompt - Generates Code With Navigation Logic

create an lwc that shows the list of cases related to an account.
each Case should be hyperlinked. 
clicking on a specific case should go to the record page of the case.

4️⃣ SLDS Grids

UI Development made easy...

🚀 Prompt

slds two column grid with 25% & 75% split

Response


5️⃣ SLDS Data Tables

Datatables are quite a frequent and common requirement when building solutions. Using ChatGPT to build the barebones code for your table can save a lot of time and effort and you can build on top of what's generated.

Here is how you can do it:

  1. Create a CSV of your table structure

    1. Open Excel or Google Sheets

    2. Create the Column headers and rows according to what you need in the table

    3. Save it as CSV

    4. Copy the CSV data - Easier way is to Open the file in a Text Editor and then copy the text

  2. Use the prompt below and replace your CSV with the CSV data in the triple backticks (``` <YOUR_CSV_HERE> ```)

🚀 Prompt

create a salesforce lightning design system table (slds) with the data below enclosed in triple backticks below.
Generate the HTML for all the rows.

```
ID,First Name,Last Name,Email
1,Friederike,Mealham,fmealham0@telegraph.co.uk
2,Ingunna,Ambrois,iambrois1@ucoz.ru
3,Kendrick,Metheringham,kmetheringham2@dropbox.com
4,Milissent,Shoulders,mshoulders3@webs.com
5,Jacynth,Grasner,jgrasner4@unesco.org
```

Response

The output of the table code generated by ChatGPT (no changes... just copy, paste & save)


We are barely scratching the surface here and the possibilities of speeding up your development process are endless.

Using ChatGPT already? I'd love to hear your experiences, share them in the comments section below!

Need more inspiration? Check out these articles: