Forums

Forums / Developing Portals / Duplicate Portal User Roles

Duplicate Portal User Roles

6 posts, 1 answered
  1. Mason Ambery
    Mason Ambery avatar
    67 posts
    Registered:
    19 Nov 2021
    13 Jan 2023
    Link to this post
    We allow self-service administration of portal access with our customers so I've created a process to create a portal user from a contact record.  One the portal user exists, their site-admin can then assign portal roles which creates the portal user role.  My issue is, the same role can be assigned multiple times.  Is there a way to prevent multiple roles from being assigned to the same user?  
  2. Rawdon Edghill
    Rawdon Edghill avatar
    76 posts
    Registered:
    16 Dec 2020
    17 Jan 2023
    Link to this post
    Hi Mason,

    Thank you for your query.

    Do you mind telling me how is that functionality being implemented, as it does sound custom. Also, can you confirm if the process is setup in the CRM or the portal.

    Regards,

    Rawdon
  3. Eric Mann
    Eric Mann avatar
    59 posts
    Registered:
    16 Oct 2020
    17 Jan 2023 in reply to Mason Ambery
    Link to this post
    Mason,
    We have something similar. I use a picklist/dropdown on an Add popout page, right above the grid that shows current roles. This is pretty effective for us in limiting this issue. You could use a Contact record field to update on each type of role then limit the dropdown/picklist based on that fetch but that can get complicated if a large number of roles. 

    Eric 
  4. Mason Ambery
    Mason Ambery avatar
    67 posts
    Registered:
    19 Nov 2021
    17 Jan 2023 in reply to Rawdon Edghill
    Link to this post
    I have this setup in the Portal.  Our portal solution is closed to existing customers and not open to the public.  We assign a security role to each customer so that they can enabling logins and assign their own security within their organizations.  

    I've created an invitation process that creates the Portal User for an existing contact within CRM.  After the Portal User is created the site admin can add roles to the user.  The Add Role is an add popup with a single dropdown.  I'm trying to prevent the site admin from selecting and assigning the same role multiple times.  There are about 20 different security roles within our portal controlling which primary navigation menus are enabled as well as submenu items.
  5. Mason Ambery
    Mason Ambery avatar
    67 posts
    Registered:
    19 Nov 2021
    17 Jan 2023 in reply to Eric Mann
    Link to this post
    This sounds very similar to what I've built and was assuming that maybe I could limit which value display in the dropdown based on the associated porter user but I'm not sure exactly how to do that.  I've done some tinkering with the fetch xml filtering but since the filter needs to be tied to the selected portal user, not the logged in user, I've not tried figuring out the filtering just yet.  I was maybe hoping that there was an easier to prevent duplicate records from being created for the same portal user. 
  6. Tariq Salim
    Tariq Salim avatar
    11 posts
    Registered:
    04 Jul 2022
    Answered
    06 Feb 2023 in reply to Mason Ambery
    Link to this post
    You can prevent multiple roles from being assigned to the same user by implementing the following steps:

    1. Write a validation rule to check if the role is already assigned to the user before creating a new role assignment.

    2. Use a unique field or custom index to enforce uniqueness on the role assignment records.

    3. Use Apex Triggers to prevent duplicates based on custom logic or business rules.

    These steps will ensure that the same role is not assigned multiple times to the same user and that only one role can be assigned to the user at a time.
6 posts, 1 answered