Headshot of Tom Hoffman next to text that says, "AI Prompt Writing for Salesforce Professionals."

AI Prompt Writing for Salesforce Professionals

By

The rise of the machines

Machines and artificial intelligence (AI) have been part of popular discussion since Samuel Butler authored Erewhon (1872), where his satirical utopian society explored the morality of conscious machines as a natural evolution of the Industrial Revolution. One-hundred and fifty years later, OpenAI released GPT-4, introducing the world to AI that can respond like a human (and do so much more!), causing us to revisit many of the same ideas.

While GPT has had several iterations (hence the -4), the latest advances have made a tremendous impact on our world. From the classroom to government, AI is front of mind in conversations across all domains. As a baseline, generative pre-trained transformers (GPT) are a family of neural network models that use transformer architecture to allow bots to produce text and image content and engage in conversations much like a human would. In its simplest sense, GPT-4, more than any other AI tool prior, has the ability to convincingly mimic human language and conversational patterns, marking a major leap forward in its potential use cases.

Need to catch up on AI before we begin? Check out Be an AI-Minded Salesforce Admin.

And you can check out my presentation on prompt writing below.

Applications for the Salesforce ecosystem

For Salesforce professionals, ChatGPT and its peers offer a variety of advantages regardless of role. There are a number of use cases by discipline where GPT technology can offer assistance.

Developers

  • Code Assistance: helps with writing code snippets, providing best practices, and explaining concepts related to Salesforce development
  • Test Classes: provides guidance on writing effective test cases, creating test data, and following best practices for unit testing
  • Query Assistance: helps write Salesforce Object Query Language (SOQL) queries and explains the syntax and structure
  • Syntax Errors: assists in identifying syntax errors in code and provides suggestions to correct them

Admins

  • Config Guidance: provides guidance on object setup, field creation, and validation rules; provides purpose/usage of different config options and best practices
  • Data Model Design: makes recommendations on the best object model to achieve a specific use case
  • Automation Planning: outlines the steps required to automate specific business processes with Flow
  • Formulas: provides formula syntax, checks formulas for errors, and suggests fixes
  • Analytics: assists with creating report types, report filters, charts, and dynamic dashboards

Architects

  • Security & Access Control: can assist with designing security models and access controls, as well as defining profiles, roles, and permission sets to enforce data and record-level security
  • Scalability and Performance: offers recommendations and best practices for designing solutions including optimizing data access, minimizing queries, and leverage caching mechanisms while handling large data volumes
  • Platform Features & Limitations: rather than internet searches and help articles, can help provide quick insights to specific features and limitations when building designs

Project Managers

  • Communications: can summarize meeting notes, draft emails, and provide guidance on effective communication strategies, expectation setting, and stakeholder engagement
  • Resource Management: given information on the capacity and availability of a team, can help determine the most suitable person for a task, balance tasks and responsibilities, and help determine roles needed for each phase of a project
  • Risk Identification: provides guidance on creating risk assessment and management framework, including common risks that need to be managed on Salesforce projects

Product Owners

  • Release Management: provides guidance on creating release cycles, coordinating teams, defining release milestones, release note preparation, and change management processes
  • Roadmapping: helps explain prioritization techniques like MoSCoW and offers insights on business value, customer impact, and feasibility
  • Requirements Gathering: assists with drafting discovery questions and approaches
  • Analysis & Research: provides industry trends, competitor product insights, and information on customer preferences to guide features

Business Analysts

  • Requirements Gathering: provides guidance on stakeholder interviews, workshop facilitation, and various techniques to capture business needs
  • Process Modeling: outlines swimlanes and process diagrams
  • User Stories: given requirements, can draft user stories and acceptance criteria
  • User Acceptance Testing (UAT): provides guidance on creating test scenarios, test cases, and acceptance criteria
  • Documentation: provided with a prompt, can draft detailed technical documentation (for example, creating users and assigning permissions)

With great power…

The above only scratches the surface of what Salesforce professionals can accomplish with AI, and these deep capabilities have to be evaluated through the lens of company policy, risks, and responsible use. There are a number of concerns and considerations when using AI as part of your job, including local rules, ethics, security, privacy, and erroneous information.

Policy and governance

It may be too simple of a take, but I’ll go for it… Before using GPT or other AI technologies to assist with your job functions, be sure to inquire about acceptable use and policies at your company. That is to say, if you’re using these tools currently without checking local policies, stop and seek guidance.

While the power and efficiency of AI tools is certainly tempting, it’s important to operate within the local governance, risk, and control frameworks of your organization. Absent a formal policy, this presents an opportunity for you to be a thought leader, helping to define accepted use cases and frame the conversation around AI in your workplace. Where policies exist, you’ll have a formal rulebook to follow to limit your personal and company risk when using AI.

Here’s a framework for shaping a policy for responsible use of generative AI at your organization.

  1. Define the purpose of generative AI: Clearly define its purpose and communicate it to all employees.
  2. Identify acceptable use: Provide specific use cases for generative AI that fit within your company’s risk and security posture.
  3. Set limitations: Identify hard limits, such as entering customer data or limiting to certain roles.
  4. Provide training: Educate employees on how to use generative AI within defined accepted uses and limitations.
  5. Monitor usage: Conduct periodic user interviews to understand who is using generative AI and how it’s being used (may want to offer amnesty to foster trust/honesty).
  6. Maintain it: Review and update the policy regularly.

Security, privacy, and data loss

I asked ChatGPT, “If you anonymize and protect data, why would you recommend a company set limitations and establish security measures for ChatGPT usage?” Its answer was pretty remarkable, especially the first bullet point.

  1. ChatGPT is not infallible: While ChatGPT is designed to protect data, it’s not 100% foolproof. There’s always a risk that data could be exposed or compromised, especially if the system is targeted by a determined attacker.
  2. Confidentiality is critical: Some types of data processed by ChatGPT may be highly confidential, such as personal or financial information. In these cases, it’s important for companies to take additional steps to safeguard the data and prevent unauthorized access.
  3. Compliance requirements: Depending on the industry or jurisdiction, there may be legal or regulatory requirements that companies must follow to protect sensitive data. For example, the General Data Protection Regulation (GDPR) requires companies to implement appropriate technical and organizational measures to ensure the security of personal data.
  4. Reputation and trust: A data breach or other security incident can damage a company’s reputation and erode trust with customers. By establishing additional security measures for ChatGPT, companies can demonstrate their commitment to protecting customer data and maintaining their trust.

Ethical considerations

It can be tempting to take a utilitarian view of ethics regarding AI usage—here’s an example. An admin is tasked with creating end user documentation for managing certain tasks in Salesforce; typically, this may be an all-day task and they have 8 hours planned for its completion. Using AI, the admin completes the task in 2 hours, so they step out for the rest of the day and submit the completed work in the morning as expected. No harm, no foul—the outcome was achieved within the time allowed, right? Looked at through the lens of freelancing, let’s say a consultant uses AI to complete a task budgeted for 8 hours of work at $200/hr. Even though they complete the task in half the time budgeted, the consultant logs 8 billable hours against the project. Still no harm, no foul?

In both scenarios, the admin and consultant are being deceptive with customers and colleagues. Viewed through ends-based ethical frameworks (utilitarianism), this may be justified, but it’s absolutely a violation of more deontological ethical thought (duty based) that is centered on what people do, not the outcome of their actions. In both cases, they were paid to create the content, and even if the requirements were met, claiming additional effort that was completed by AI is unethical and was not the expectation.

This isn’t meant to devolve into a philosophical debate (queue the trolley problem!) but rather to stress that we should approach AI usage in the workplace with the highest concern for ethical practice, with an emphasis on honesty, fairness, and transparency to encourage adoption.

Conversational AI is a great conman

Say anything with conviction and authority and an uninformed audience will generally believe your claims. Remember: Conversational AI is built to respond with human language patterns and convincing authority, not necessarily correctly. In my conversations with conversational AI, I’ve found many instances where it provided incorrect answers, both factually incorrect and those that violate Salesforce best practices. Here are a few examples.

  • When I asked it to outline a flow that would find records related to child records of a particular Account, the flow included Data Manipulation Language (DML) statements inside of loops. When redirected to use Salesforce best practices, it correctly indicated an IN function should be used to remove the DML from the loop. However, absent that knowledge, an unfamiliar user could implement a solution that would not scale and likely fail in robust production use cases.
  • I asked ChatGPT to create a validation rule to prevent an opportunity from being edited when an opportunity was closed; the provided validation rule referenced the IsClosed/IsWon values, which, due to order of execution, is discouraged by Salesforce.

Conversational AI is not a substitute for our knowledge as Salesforce professionals. It’s a tool to assist us, not replace us. It’s critical to continue in the pursuit of deep platform knowledge to be able to safely and appropriately use AI as part of our solutions and configurations.

Okay, on to the good stuff!

I appreciate your indulgence in entertaining the previous section. I’m enamored with the potential AI has to transform how we work, but I believe we must ensure AI adoption is done responsibly, honestly, and in a manner that encourages its adoption vs. making companies enforce strict measures against it.

With that, I’ll descend the several flights of steps from my soapbox and get to the fun stuff: writing prompts that can help you in your day-to-day role in the Salesforce world.

When writing prompts, here are a few tips to help get detailed and accurate responses.

  • Generative AI is conversational. It has the ability to draw on its prior answers and expand. After an initial prompt, you can refer back to a response inside of a conversation and prompt ChatGPT to expand, clarify, defend, change, or correct a part of a prior answer.
  • Small details have a big impact on the response. In an example below, I initially asked ChatGPT to help design a security model given specific criteria. In its response, it left out organization-wide defaults (OWD). I amended my prompt to “How can I design a security model (including OWD) to meet these requirements?” and it added the correct OWD as the first point in its response.
  • Building on both of those points, I’ve found it’s better to start slightly wider and then narrow it down with ChatGPT prompts. When asking the first prompt/redirect below as a single prompt, I received a very generic response that was more a recitation of facts about the terms. I changed my prompt to ask a more general question, received a much richer answer, and then asked ChatGPT to expand on the more detailed areas of the topic to achieve the desired results with success.

Below are examples of prompts and conversations I’ve had with ChatGPT, grouped by their purpose: gaining knowledge, solving problems, and helping with design.

Knowledge-building prompts

After a dozen years on the platform, I still run into products, features, and concepts where my knowledge is not as deep, I don’t have my own words to accurately explain them, or I’m looking to learn new information about something I know well. I consider these knowledge-building prompts, as they don’t solve a particular challenge or assist with a specific design, but instead provide a quick assist in finding information to shore up my Salesforce foundation. Some examples are:

  • Can you explain the principle of least privilege as it relates to Salesforce security?
    • Can you expand on your prior answer with how to plan for implementing permission sets and permission set groups as the primary function for permissions instead of profiles?
  • Can you explain the benefits of owner- vs. criteria-based sharing?
    • What indications point to one vs. the other?
    • Which one is more efficient?
  • Can you explain lookup skew in Salesforce?
    • How would you summarize that for an executive audience?

Technical support prompts

ChatGPT does a remarkable job at providing a starting point for troubleshooting in Salesforce. Given a specific error message, formula, or request around how to configure a specific requirement, it provides quick insights and suggestions to help start your effort. It’s also tremendously helpful in translating the intent of existing formulas, validation rules, and Apex classes when encountering others’ work that may not be well documented. Here are a few examples.

  • I need a SOQL query for Salesforce Data Loader that exports only those contact records where the parent Account Type = Prospect and Contact.Owner is not active.
  • Oof! You’re a new admin at an organization where the prior team did not do a good job documenting and you run into a monster formula you’re having trouble understanding.
    • A massive formula.
    • Can you find the error in this formula?
  • Can you write a validation rule that limits the ability to edit an opportunity record to only a certain group of individuals based on their profile?
    • Can you rewrite that validation rule to use a custom permission assigned to profiles rather than hard coding profile names?
  • A user with Read/Write access to an opportunity is receiving an ‘insufficient access rights’ error when hitting save on the opportunity; what should I check to help find the issue?

The prompts above are just a few scenarios I’ve used, largely with great results. But, as noted above, responses may not always follow acknowledged best practices, so generative AI should be considered a job aide vs. a tool to replace understanding and effort on our behalf.

Architecture and design prompts

I’ve found generative AI to be very helpful in the solution design process to quickly put into words a solution to a specific requirement. As with the first example below, while I know the answer heading in, it allows me to quickly put the structure and words into the tech spec for a specific requirement, once I’ve validated the provided answer follows best practices and meets all aspects of the requirement. For others, it provides a starting point for deciding an approach to sharing an automation design that I can use to inform my final solution. The examples below demonstrate how architects can quickly express existing knowledge, defend design decisions, and outline approaches to make our work more efficient.

  • I have three user groups: Group A needs the ability to edit only opportunities they own; Group B should be able to view all opportunities but not edit them; and Group C should only be able to view opportunities after they are Closed Won while only editing the First Year ACV and Total Contract Value fields. How can I design a security model (including OWD) to meet these requirements?
  • What are the benefits and drawbacks of using one record-triggered flow per object vs. multiple record-triggered flows per object with entry criteria?
  • Can you outline a flow that would update a field on invoice lines related to opportunities from a specific account?
    • Instead of querying inside the loop to identify invoice lines from the opportunity collection, can you use the IN function?

Continuing the conversation

AI technology is bringing a swath of new opportunities, and the conversation is just beginning. As the Salesforce ecosystem expands its adoption of AI, we’ll continue to help Trailblazers explore and understand it. To dig in deeper, check out the resources below.

Resources

How Salesforce Einstein Is Supercharging Mobile Experiences.

How Salesforce Einstein Is Supercharging Mobile Experiences

While its impact is widespread, one of the most exciting aspects of artificial intelligence (AI) is its ability to create conversational interactions that generate personalized experiences, supercharging productivity and efficiency. In this blog post, we’ll explore how the implementation of large language models on mobile devices is reshaping the enterprise mobile landscape and how Salesforce […]

READ MORE
Einstein surrounded by foliage and text that says "What Generative AI Means for Admins."

Understanding What Generative AI Means for Salesforce Admins

Understanding the fundamentals of artificial intelligence (AI) is critical to being an #AwesomeAdmin. This technology has opened up broadly and both people and businesses are finding new and inventive ways to weave it into products and our lives. There’s no better time to get up to speed on AI and how you will be able […]

READ MORE

AI for Admins: What You Need to Know to Make Einstein Bots a Success

Einstein Bots interact with your customers quickly and accurately with automation and artificial intelligence (AI) capability. In terms of AI initiatives, the biggest challenge is measuring business impact. One reason most AI projects fail is that people are looking at “model performance” instead of business value, such as how much money, in either additional revenue […]

READ MORE