Automatically Disable Community Users After a Set Period of Time
It is possible to set Community Users to be deactivated after a set period of time, such as 30 days of inactivity. To enable this functionality the System Administrator will need to enter Custom Settings to control which profiles are disabled and when, then an Apex Job needs to be scheduled. When the Apex Job is run the Users meeting the criteria will be disabled.
Enter the Custom Setting and Create the Apex Job
- Navigate to Setup > Custom Code > Custom Settings.
- Click Manage next to TimeCards Settings and then click the Edit button.
- Populate the following fields then Save:
- Navigate to Setup > Custom Code > Apex Classes.
- Click the Schedule Apex button.
- Create a new schedule with the fields then click Save:
- Job Name: Enter a descriptive name, such as Community User Deactivation.
- Apex Class: Use the lookup to find UserBatchScheduler.
- Schedule Apex Execution: Choose a frequency, day, and time, ideally during non-working hours.
Was this helpful?