In our last blog post, we explored the fundamentals of Salesforce Flows by building a basic Screen Flow to deliver personalized greeting messages. Continuing on this journey, we now shift our focus to a practical application: creating records using Screen Flows.
The Requirement:
Our goal is straightforward: create a Contact record using a Screen Flow. Additionally, we'll add this flow into the Account lightning record page, ensuring users can effortlessly add contacts to associated accounts.
Step-by-Step Guide
Let's walk through the process:
Create a New Screen Flow: Navigate to Flows, click on "New Flow," and select "Screen Flow" as the flow type.
Design the Screen Layout: Add a screen action and drag relevant sections onto the flow canvas to display contact creation fields to users. In this case, we include fields like Name, Phone, and Email.
Configure Record Creation Component: Add the "Create Records" component to the flow. Specify the object (Contact) and map the values entered by the user from the previous screen component to the corresponding contact fields.
Mapping the Account: To associate the newly created contact with the account, create a resource with the text data type and mark it as "Available for input." This allows passing the Account ID from the lightning record page to the flow.
Save and Activate the Flow: Once the flow is designed and configured, save it and activate it for use.
Integrate with the Account Lightning Record Page: Edit the Account record page, drag the Flow component onto the desired location, select the checkbox “Pass record ID into this variable“ and save the page.
Test the Flow: Return to the Account record page, enter the required contact details in the flow, and proceed. Verify that the new contact is successfully created and associated with the Account.
By following these simple yet powerful steps, you can leverage Salesforce flows to streamline the process of creating records. Integrating flows directly into record pages enhances user experience and efficiency, empowering your team to accomplish tasks seamlessly within the Salesforce environment.
Stay tuned for more insightful tutorials and real-world use cases in our ongoing Salesforce Flow Series. Have questions or need further assistance? Feel free to reach out – we're here to help!