Skip to main content
Free Agentforce workshops and AI Certifications: Learn more. Terms and conditions apply.
Estimación de tiempo
Temas
Preguntar a la comunidad

Fix Access Issues in a Flow

Learning Objectives

After completing this unit, you’ll be able to:

  • Break down how the debug feature works.
  • Use the debug feature to fix a broken flow.
  • Debug as a running user.

The Why

Flows can involve a lot of moving parts. All the parts have to work properly for the flow to be successful. If one part breaks, the whole flow does not, well, flow. While there are many different reasons a flow can break, there are some common culprits.

  • Using the wrong field
  • Using the wrong variable
  • Object and field level security for running user
  • Too many SOQL queries
  • Null values

Don’t worry, these issues are identifiable and in turn, fixable. In fact, Salesforce sends an error email in the default language of the user who ran the flow. The email is sent to either the admin who last modified the associated flow or the Apex exception email recipients. The email includes the error message from the failure and details about each flow element that the flow interview executed. With that in mind, time to get your hands dirty by fixing a broken flow. 

The Problem

One of your users, Mario Cruz, has recently been promoted to a newly created position, senior sales associate. As the admin, you’ve received a complaint from Mario. He can’t complete the new customer information screen flow. Time to investigate. Your first stop when troubleshooting a flow is the built-in debug feature found within Flow Builder.

  1. Click on the gear icon setup gear and select Setup.
  2. Enter flows in the Quick Find box and select Flows.
  3. Click Create New Customer.
  4. Review what the flow is attempting to accomplish. A user enters data on a screen and a new account, contact, and opportunity are created.
  5. Click Debug.
    Note: Debug interacts with your org data. In this situation, if the flow interview is successful, you create a new account, contact, and opportunity in your Trailhead Playground org. Best practice is to debug a flow in a sandbox.
  6. Leave all selections as is and click Run.

The debug screen is showing exactly what the end user would see but with Debug Details to the right. 

  1. Enter the following data:
    • Company Name: Cloud Kicks Inc.
    • Contact First Name: Chris
    • Contact Last Name: Johnnsel
    • Phone Number: 770-867-5309
    • Opportunity Stage: Qualification
    • Close Date: [leave as is]
  2. Click Next.
  3. Review the Debug Details to see the results.

Well, it worked?! Curveball: The flow worked just fine… for you. The most important part of the previous sentence is for you. This is good news and bad news. Good news, the flow works, but bad news, it still does not work as expected for your user. Your next stop is to see the problem from Mario’s (the user) perspective.

A Different Point of View

You may be thinking to yourself, “I’d just log in as Mario and see what’s going on.” A fine idea, but you need more information. You need to use that fancy debug feature, but as Mario. If only you could do something like that… oh wait, you can! Step one, allow admin to debug flow as another user. 

  1. Depending on your browser, return to the open Setup tab or click back Flow Builder back button from the Flow Builder.
  2. Click on the gear icon setup gear and select Setup.
  3. Enter Process Automation Settings in the Quick Find box and select Process Automation Settings.
  4. Click the magnifying glass icon next to Default Workflow User text box.
  5. Search and select your name.
  6. Select the Let admins debug flows as other users checkbox.
  7. Click Save.
  8. Enter flows in the Quick Find box and select Flows.
  9. Click Create New Customer.
  10. Click Debug.
  11. Select Run flow as another user.
  12. Click in the User box and type Mario.
  13. Select Mario Cruz.
  14. Click Run.

Notice in the Debug Details that it now lists the running user as Mario Cruz.

  1. Enter the following data:
    • Company Name: Ursa Major Solar
    • Contact First Name: Grace
    • Contact Last Name: Yiena
    • Phone Number: 941-555-0103
    • Opportunity Stage: [leave as is]
    • Close Date: [leave as is]
  2. Click Next.
  3. Review the results.

As you can see, “Something went wrong.” Scroll to the top of the Debug Details and follow the results of the flow interview. This information is also emailed to you, the admin. 

Breakdown of Results

  • SCREEN: Enter_Customer_Information: Data was entered correctly.
  • CREATE RECORDS: Create_Account: You can see that “A record is ready to be created when the next screen, pause, or local action is executed or when the interview finishes,” which means that the account record will be successfully created.
  • CREATE RECORDS: Create_Contact: The contact record will be successfully created (upon the completion of the flow).
  • CREATE RECORDS: Create_Opportunity: “Failed to create record.” The opportunity record failed.

The opportunity record failed. Why could that be? Think back to the common culprits. If you are thinking object and field level security for the running user, you’d be correct. If a user is denied access to a field or object in the org, that’s also true in a flow. 

Mario’s new role requires additional access within the Salesforce org. The next logical thing to do is fix his access so that he can complete the screen flow as intended. Start at the most likely issue, user profile.

Access Granted

First stop, check to see if Mario has the correct user profile for his job responsibilities.

  1. Depending on your browser, return to the open Setup tab or click back Flow Builder back button from the Flow Builder.
  2. Enter users in the Quick Find box and select Users.
  3. Click Cruz, Mario and identify the profile assigned to his user.

Does it say Custom: Sales Associate Profile? Uh oh, looks like you found the issue. This profile has certain restrictions, including being unable to create a new opportunity. Everything within this profile still applies to Mario, he just needs access to create an opportunity. 

Permission sets to the rescue. Apply the Create Opportunity permission set to Mario’s user to account for this need.

  1. Enter permission sets in the Quick Find box and select Permission Sets.
  2. Click the Create Opportunity permission set.
  3. Click Manage Assignments.
  4. Click Add Assignments.
  5. Add a check next to Cruz, Mario.
  6. Click Assign.
  7. Click Done.

Return to the flow and run the debug as the user to make sure everything is working as expected.

  1. From setup, enter flows in the Quick Find box and select Flows.
  2. Click Create New Customer.
  3. Click Debug.
  4. Select (add check) Run flow as another user.
  5. Click in the User box and type Mario.
  6. Select Mario Cruz.
  7. Click Run.
  8. Enter the required data of your choosing to complete the debug.
  9. Review the Debug Details. You should now see the congratulations screen.

Confetti, confetti, confetti! The flow now works for Mario Cruz too. You not only debugged a flow as a different user, you fixed Mario’s access so the flow is not “broken” for him. In the next unit, you learn about more resources to help you fix another flow. So keep on flowing (get used to the puns) to the next unit.

Comparta sus comentarios sobre Trailhead en la Ayuda de Salesforce.

Nos encantaría conocer su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios cuando quiera desde el sitio de la Ayuda de Salesforce.

Más información Continuar para compartir comentarios