function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nirmal ChristopherNirmal Christopher 

How to Limit number of users in Customer Portal?

Hi everyone,

I have a Case where I need to control the number of users created for customer portal with respect to ech account.

For example: I have Account A under which I have contacts 1,2,3,4,5. out of the five contacts the Administrator or delegated administrator should have the ability to limit the number of users can be created from each contact.

Is it possible to create a picklist field in the accounts objects with the values  like 1 2 3 ttc and based on the selection is it possible to limit the number of users created for each account?

Idea to Implement trigger is appreciated
gokul bharatigokul bharati
Hi Nirmal,

Please find the steps which might help you:

Create a pick list Field in Account Object.

Write a trigger on event before insert

User with User Licence Type(Customer Portal) should be considered.
Next,Store the Account Id in a set.
Create a map between set of account Id and picklist field(no of user can be created) 
Create a map between set of account Id,count of user.

a.addError('Reached the Limit');