Who can run the Flow and how

There are various concepts related to who can run the Flow and how, what kind of permission is required to run a Flow, and what happens when an organization wants to open a Flow for external users or unauthenticated access? To see the Flow detail page, users must have View Setup and Configuration system permission; the users that have the Manage Force.com Flow system permission can open, create, delete, activate, deactivate, or delete Flows.

Debugging insufficient privileges on the custom button/link

A business scenario: Helina Jolly is working as a system administrator in Universal Container. She developed a Flow, that is, Create Leads, in Chapter 3, Manipulating Records in Visual Workflow (under the Hands on 1 – creating leads and Hands on 2 – adding leads to a campaign sections), and embedded it into the custom button. She has received several e-mails from users saying that they are getting Insufficient Privileges Errors when they click on the Create Lead button, as shown in the following screenshot:

Debugging insufficient privileges on the custom button/link

If a system administrator embeds a Flow into the custom button or link, then to run a Flow, the user must have either the Run Flows system permission under profile, or the Force.com Flow User feature license selected in the user record.

Embed a Flow into a Visualforce page

A business scenario: Alice Atwood, who is working as a system administrator in Universal Container, received a requirement from her manager to grant the Create Leads Flow access to partner community users.

The partner community profile doesn't have the Run Flows system permission, and you can't assign the Force.com Flow User feature license to them. So, a way to work around this is to use Visualforce Page. The steps for granting permission to partner community users to a Flow are as follows:

  1. Create a Visualforce Page by navigating to Setup | Build | Develop | Pages and click on the New button. Use the standard controller campaign in this case, as shown in the following code:
    <apex:page standardController="Campaign">
    <flow:interview name="Create_Leads"> // Flow interview component is used to embed flow in a Visualforce page. Create_Leads is flow Unique Name.
    <apex:param name="VarTCampaignID" value="{!Campaign.ID}"/>
    // apex:param is used to pass variable CampaignID value to a flow
    </flow:interview>
    </apex:page>
  2. Save this Visualforce page with the name Flow_Partner_Community.
  3. The next task is to grant the Visualforce page access to the partner community users. To do that, navigate to Setup | Administer | Manage Users | Profiles and select the partner community profile to whom you want to grant access to. Then, navigate to Apps, under the Profile Overview page, and then select Visualforce Page Access. Next, click on Edit and move desired the Visualforce page from Available Visualforce Pages to the Enabled Visualforce Pages pane.
    Embed a Flow into a Visualforce page
  4. Once you are done, click on Save.
  5. The next step is to create a custom button to call a Visualforce page on the campaign object. To create a custom button, navigate to Setup | Build | Customize | Campaigns | Buttons, Links, and Actions and click on the New Button or Link button. Enter the Name field as Create Lead VF; for Display Type select Detail Page Button, for Behavior select Display in existing window without sidebar or header, for Content Source select Visualforce Page, and then from the Content dropdown, select the Visualforce Page of Flow_Partner_Community, and click on OK. It will look like the following screenshot:
    Embed a Flow into a Visualforce page
  6. The next task is to add a new custom button on the campaign page layout. Navigate to Setup | Build | Customize | Campaigns | Page Layouts, click on the Edit link, and drag and drop the custom button Create Lead VF onto the page layout and save the changes.
  7. Now, log in through partner community users and try to create leads by clicking on the Create Lead VF custom button.

Note

To create a lead, a user must have to create permission on the lead object.

If you have embedded the Flow into a Visualforce page, there are also few ways in which users can use it to run a Flow. They are as follows:

  • Custom buttons or links
  • Visualforce tabs
  • Force.com Sites
  • Salesforce1 action
  • Salesforce1 navigation menu
  • Inline Visualforce page

We will see this one-by-one later on in this chapter.

Invoke a Flow using Process Builder

Until now we have seen many Flows, but invoking or calling a Flow requires user intervention. There are many requirements for which we want a way to automatically call without a manual intervention.

To improve user adoption in the organization, management at Universal Container wants to implement a business process: if a user has not logged in in the last 15 days, auto freeze their user account and send out an e-mail to the user as well as system administrator.

To solve this requirement, we have to use Flow, and to autofire Flow we can use Process Builder. We will see similar examples in detail in Chapter 6, Building Applications without Code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.75.221