Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Optimizing Salesforce Flows

Save for later
  • 13 min read
  • 24 Jan 2024

article-image

Dive deeper into the world of AI innovation and stay ahead of the AI curve! Subscribe to our AI_Distilled newsletter for the latest insights. Don't miss out – sign up today!

This article is an excerpt from the book, ChatGPT for Accelerating Salesforce Development, by Andy Forbes, Philip Safir, Joseph Kubon, Francisco Fálder. Harness ChatGPT for streamlined flows, effective configuration, proficient code writing, and enhanced project activities.

Introduction

Embark on a journey through Salesforce wizardry in this article as we delve into the art of optimizing Flows for email functionality within the Snowflake data realm. Picture this: you, the savvy sales rep, armed with a wizard that guides you through the intricate process of selecting the perfect contact for your email endeavors. Join us in dissecting a case study, navigating through user stories, and tackling challenges head-on. We'll explore the nitty-gritty details, gaps, and tricks to ensure a seamless Salesforce experience. Get ready to enhance your Flow game and witness the magic unfold in the world of Salesforce efficiency!

Enhancing Email Selection Wizards for Sales Efficiency

The case study from Appendix A has several user stories that can be addressed with Flows.

Let’s use the base flow request:

Please provide detailed directions on how to create a Salesforce Flow to address the following user story. Please note any gaps in the user story that leave an opportunity for misunderstandings, as well as any parts of the flow that may be tricky to create. Include error handling in the Flow, and write a description of what the Flow does for the project documentation.

We’ll also use epic 3 and user story 2 from the case study to investigate ChatGPT’s capabilities.

Epic 3 – email functionality with Snowflake data

User Story 2 – create a Flow-based wizard to select a contact:

• Goal: As a sales rep, I want a wizard to guide me through the process of selecting a contact to send the email to so that I can choose the correct recipient.

• Acceptance criteria:

Given a sales rep clicks the Email button in the Snowflake section

When the wizard starts

Then the sales rep should be prompted to select a contact associated with the account

Let’s take a look:

Prompt:

Please provide detailed directions on how to create a Salesforce flow to address the following user story. Please note any gaps in the user story that leave an opportunity for misunderstandings, as well as any parts of the flow that may be tricky to create. Include error handling in the flow, and write a description of what the Flow does for the project documentation.
Epic 3 – email functionality with Snowflake data
User story 2 – create a Flow-based wizard to select a contact:
•    Goal: As a sales rep, I want a wizard to guide me through the process of selecting a contact to send the email to so that I can choose the correct recipient
•    Acceptance criteria:
‚    Given a sales rep clicks the Email button in the Snowflake section
‚    When the wizard starts
‚    Then the sales rep should be prompted to select a contact associated with the account

Response: 

Certainly! Let’s address the user story and design a Flow-based wizard to select a contact for emailing in Salesforce. We’ll also examine any potential gaps and challenges in the process.
Flow design for email functionality with Snowflake data:

1. Start the Flow:

Trigger: The Flow will be triggered by clicking an Email button within the Snowflake section

Action: A wizard screen will appear, prompting the sales rep to proceed with selecting a contact associated with the account

2. Screen Element for Contact Selection:

Create a screen element with a dropdown that lists contacts associated with the account

This list should be dynamically generated based on the account related to the Snowflake section

3. Error handling and validation:

Include logic to check if there are any contacts associated with the account If no contacts are found, an error message should be displayed to the sales rep

4. Finish the Flow:

Once the contact has been selected, the wizard should end, and the selection should be available for further processing, such as sending an email Gaps and challenges:

Ambiguity in the Snowflake section: The story does not clearly define what the “Snowflake section” refers to. Understanding its context is essential to properly link the Email button to the flow.

Selection process clarity: The story does not provide details on what happens after contact selection, which might require collaboration with other stakeholders for complete understanding.

Account association: Ensuring that the listed contacts are relevant to the specific account can be tricky and needs careful handling.

Project documentation

Flow name: Contact selection wizard for Snowflake email functionality.

Description: This Salesforce flow enables sales reps to select a contact associated with an account within the Snowflake section by guiding them through a wizard. Triggered by clicking the Email button, the Flow provides a drop-down list of relevant contacts for selection, includes error handling to deal with scenarios where no contacts are found and ends with the selected contact being available for email communication.

Associated epic: Epic 3 – email functionality with Snowflake data.

User story: User story 2 – create a Flow-based wizard to select a contact.

Goal: To facilitate the correct selection of an email recipient by guiding the sales rep through a structured process.

By carefully considering these steps, challenges, and potential gaps, this Flow aims to provide an intuitive and error-free way for sales reps to select the appropriate contact for their email communications within the Snowflake section. It underscores the importance of alignment with stakeholders to ensure the full context and intended behavior of the Flow are understood and accurately implemented.

ChatGPT identified three gaps and challenges. Let’s prompt ChatGPT to refine the answer based on answers to the gaps and challenges:

Prompt:

The Snowflake section on the contact page layout is a tab dedicated to displaying information from Snowflake. There are additional user stories that address what happens after this user story. The contacts to be listed are the ones where the account lookup field on the contact is all the same account. With these answers, please update and rewrite the response. Anything unaffected by these answers does not need to change. 

Response:

Certainly! With the additional context provided, let’s refine the Flow design to create a Salesforce Flow-based wizard that aligns with the user story and its requirements.

Flow design for email functionality with Snowflake data:

1. Start the Flow:

Trigger: The flow will be triggered by clicking an Email button within the Snowflake tab on the contact page layout

Action: A wizard screen will appear, prompting the sales rep to proceed with selecting a contact associated with the account

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at R$50/month. Cancel anytime

2. Screen element for contact selection:

Create a screen element with a dropdown that lists contacts associated with the same account, where the account lookup field on the contact matches the specific account

This list should be dynamically generated based on the account related to the

Snowflake tab

3. Error handling and validation:

Include logic to check if there are any contacts associated with the specific account. If no contacts are found, an error message should be displayed to the sales rep

4. Finish the Flow:

Once the contact has been selected, the wizard should end, and the selection should be available for further processing, as defined in the subsequent user stories.

Gaps and challenges:

Account association: Ensuring that the listed contacts are relevant to the specific account and filtered by the account lookup field can be tricky and needs careful handling.

Project documentation

Flow name: Contact selection wizard for Snowflake email functionality.

Description: This Salesforce flow enables sales reps to select a contact associated with an account within the Snowflake tab on the contact page layout. Triggered by clicking the Email button, the flow provides a drop-down list of contacts where the account lookup field matches the specific account. It includes error handling to deal with scenarios where no contacts are found and ends with the selected contact being available for further processing as detailed in subsequent user stories.

Associated Epic: Epic 3 – mail functionality with Snowflake data.

User Story: User story 2 – create a Flow-based wizard to select a contact.

Goal: To facilitate the correct selection of an email recipient by guiding the sales rep through a structured process within the Snowflake tab.

By integrating the details about the Snowflake section and the specific Account relationship, this refined flow design aims to provide a seamless experience for Sales Reps in selecting the appropriate contact for email communications. It emphasizes the precision needed in filtering contacts based on the Account lookup field, thus catering to the specific requirements of the given user story.

Even though the “Account Association” concern seems to have been addressed, ChatGPT is still listing it as a concern. This could be a ChatGPT quirk or there could still be a gap. Let’s directly ask for an explanation:

Prompt: 

Under “Gaps and Challenges” is Account Association: ensuring that the listed contacts are relevant to the specific account and filtered by the account lookup field can be tricky and needs careful handling.

I thought I addressed this by telling you that “The contacts to be listed are the ones where the account lookup field on the contact are all the same account.”

Why is this tricky? What is needed to resolve this “Gap and Challenge”?

Response:

My apologies for the confusion. Your direction does indeed clarify the requirement, but let me further explain why I considered this as a potential challenge.

The “tricky” part I mentioned relates to the design and implementation phase of the flow, specifically in the context of Salesforce. Here’s why:

1. Query complexity: Retrieving contacts based on the specific account lookup field requires a well-constructed SOQL query. While it’s a straightforward requirement, the developer must ensure that the query is efficient, especially if there are large numbers of contacts related to an account.

2. Contextual handling: The Flow must recognize the specific account related to the Snowflake tab from which the Email button is clicked. This requires proper handling of contextual information, ensuring that the correct account ID is used in filtering the contacts.

3. Dynamic filtering: If the Account field is ever updated, or if the context changes dynamically within the user interface, the flow must respond accordingly, updating the list of contacts. Ensuring that this dynamic filtering works smoothly can require careful testing and validation.

4. Permissions and security: Ensuring that the user has the appropriate permissions to view and select the contacts related to the specific account must be considered.

This involves compliance with the Salesforce org’s security model.

Resolution:

1. Construct a robust SOQL query: Build a well-designed SOQL query to fetch contacts based on the specific account lookup field.

2. Contextual Handling: Utilize the context of the button click within the Snowflake tab to identify the relevant account, possibly using Apex if necessary.

3. Test dynamically: Implement tests to ensure that the dynamic filtering of contacts works as expected as the context changes.

4. Consider security: Align the flow with the Salesforce org’s security protocols to ensure that it adheres to the relevant permissions and profiles.

In the hands of an experienced Salesforce developer like yourself, these challenges would be well within reach to overcome. I mentioned them to highlight potential areas that might require attention, and they can be seen as aspects to validate rather than insurmountable obstacles.

And since the authors want to get along with our AI overlords, here’s the prompt we provided:

Prompt:

Thank you for your explanation of how to address this “Gap and Challenge” as well as for your help with this user story!

Response:

You’re welcome! It’s been a pleasure working alongside you on this user story. Your in-depth knowledge and detailed questions have enabled a clear and precise understanding of the requirements. Should you have any more questions or need further assistance, feel free to reach out. Here’s to a successful implementation of the Flow, and may it greatly enhance the functionality and user experience within your Salesforce environment. Happy developing!

Conclusion

And there you have it – a deep dive into the world of Salesforce wizardry! From refining Flows to addressing challenges and optimizing for Snowflake data, we've navigated the intricate landscape of email functionality. Picture your sales team empowered with intuitive wizards, seamlessly selecting contacts for emails. As we wrap up, remember the key: precision in design and collaboration with stakeholders. Let this be a guide for a successful implementation, enhancing your Salesforce environment. Here's to smooth workflows, error-free communication, and a Salesforce experience that truly works its magic for you! Happy developing! 

Author Bio

Andy Forbes stands at the vanguard of technological innovation. With a career spanning four decades, he is currently focusing his robust IT background on exploring the transformative potential of artificial intelligence, particularly Generative AI, on Salesforce project delivery. Andy has honed a deep expertise in CRM and project management which is backed by his repertoire of ITIL and Salesforce certifications. Andy's eight-year tenure at a Global Systems Integrator, coupled with his entrepreneurial spirit, has propelled him to the leadership of multiple Salesforce projects for Fortune 500 clients.

Philip Safir is a consulting executive and business architect. He serves enterprises via delivery of technology roadmaps, process improvement, and solutions on the Salesforce platform. As the Head of Salesforce Professional Services Delivery & Talent for a Global Systems Integrator, he is responsible for a team of 250 consultants and a $100M portfolio. His career spans Fortune 500, start-up, and international clients across various industry domains like Manufacturing, Retail, Financial Services, Telecom, and so on.

Joseph Kubon, an experienced Solution Architect for global enterprise deliveries, Salesforce MVP with 40+ Salesforce certifications and inventor (holding several patents), navigates the realms of manufacturing, health and media industries with a results-driven approach. Skilled in Agile methodologies, Business Process, and Architecture values, he carries a toolkit replete with Salesforce configuration and customization expertise for groundbreaking development. Guided by the wisdom that 'just because it can be built doesn't mean it should be', Joseph embraces the multiplicity of solutions to tomorrow's challenges measuring success with his “Time to Value” principles.

Francisco Fálder is a seasoned Salesforce maven and master of digital transformation. His career stands as a testament to a commitment to delivering top-tier, complex projects, seamlessly merging business and tech to deliver standout customer experiences. With every project, Paco re-imagines and redefines the digital landscape, fostering an environment where innovation is not only encouraged but celebrated. Passionate about the ever-evolving tech world, he has honed a deep-rooted affinity for Artificial Intelligence, Continuous Integration/Continuous Deployment (CI/CD), and Agile methodologies.