---
schema_version: "1"
id: 56c6053233880b78eac5be8b75c72433084d288c537deac6bfa0db1b2758ee05
title: Create a Flow That Can Activate or Deactivate a Session-Based Permission Set
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/perm_sets_session_activate_flow.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.perm_sets_session_activate_flow.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 573051aa37cea9a4629f7399de11e706b25cdd7f31bed6a58cd731b65797ef9e
description: You can create a session-based permission set and then create a flow that users can run to activate or deactivate the permission set themselves.
products:
  - Security
  - Salesforce Platform
release: "264"
---
# Create a Flow That Can Activate or Deactivate a Session-Based Permission Set

You can create a session-based permission set and then create a flow that users can run to activate or deactivate the permission set themselves.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class="" id="perm_sets_session_activate_flow__FireflyEdition_noExperience"><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <span id="perm_sets_session_activate_flow__FireflyEdition_noExperience_ph"><a name="perm_sets_session_activate_flow__FireflyEdition_noExperience_ph"></a><strong>Essentials</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</span></td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d12042e79">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d12042e79 ">To create permission sets:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d12042e79 ">Manage Profiles and Permission Sets</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d12042e79 ">To assign permission sets:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d12042e79 ">Assign Permission Sets</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d12042e79 ">To open, edit, or create a flow in Flow Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d12042e79 ">Manage Flow</td>

          </tr>
        </tbody>
      </table>

Before beginning, check out [Session-Based Permission Sets](https://help.salesforce.com/s/articleView?id=platform.perm_sets_session_use.htm&release=264.0.0&type=5 "A session-based permission set applies to a specific user session to grant someone functional access to permissions.") to learn when to use them.

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-access-264-0-0-production-enus/a92be132-3cbc-412a-9262-130636120c14/images/icon_important.png)

Important You can run queries, however, don’t make data or object updates in flows that also activate session-based permission sets.

You can’t both activate and deactivate a session-based permission set in the same flow. You must create separate flows for these actions.

1. [Create a permission set](https://help.salesforce.com/s/articleView?id=platform.perm_sets_create.htm&release=264.0.0&type=5 "Create permission sets that contain the permissions necessary for your users to complete a specific job or task.") and make sure to select **Session Activation Required**.
2. [Assign the permission set to users](https://help.salesforce.com/s/articleView?id=platform.perm_sets_manage_assignments.htm&release=264.0.0&type=5 "You can assign permission sets to a single user from the user detail page or assign multiple users to a permission set from any permission set page.").
3. [Create a flow](https://help.salesforce.com/s/articleView?id=platform.flow_build.htm&type=5&language=en_US) in Flow Builder.
    1. Use a Get Records element to look up the permission set.
    2. In the Get Records element, store the permission set’s name in a variable, so that you can use the name in the action.
    3. Drag a Core Action element onto the canvas, and choose either **Activate Session-Based Permission Set** or **Deactivate Session-Based Permission Set**.
4. Activate your flow.
5. [Distribute your flow](https://help.salesforce.com/s/articleView?id=platform.flow_distribute.htm&type=5&language=en_US) to users who must run it.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-access-264-0-0-production-enus/a92be132-3cbc-412a-9262-130636120c14/images/icon_example.png)

Example

Create a flow to pass a permission name to the Activate Session-Based Permission Set core action. First, add a Get Records element to your flow to look up the PermissionSet object. Set the Name field to the name of your session-based permission set. Then add the Activate Session-Based Permission Set core action, and set the input to your permission set name.

![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-access-264-0-0-production-enus/a92be132-3cbc-412a-9262-130636120c14/images/icon_tip.png)

Tip Make sure that users who run your flow have the Run Flows permission.

When the flow activates the session-based permission set, the running user obtains access to the permissions specified in your permission set during the current user session. If the flow deactivates the session-based permission set, the permissions are no longer available to the user.

#### See Also

- [Permission Sets](https://help.salesforce.com/s/articleView?id=platform.perm_sets_overview.htm&release=264.0.0&type=5 "A permission set is a collection of settings and permissions that give users access to various tools and functions. Permission sets extend users’ functional access without changing their profiles and are the recommended way to manage your users’ permissions.")
- [Session-Based Permission Sets](https://help.salesforce.com/s/articleView?id=platform.perm_sets_session_use.htm&release=264.0.0&type=5 "A session-based permission set applies to a specific user session to grant someone functional access to permissions.")
- [Flow Core Action: Activate Session-Based Permission Set](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_actions_activate_sessionpermset.htm&type=5&language=en_US)
- [Flow Core Action: Deactivate Session-Based Permission Set](https://help.salesforce.com/s/articleView?language=en_US&id=sf.flow_ref_elements_actions_deactivate_sessionpermset.htm)