Hi Garrett,
The most efficient way to go about restricting user access to the CRM afterhours is by building some logic into your screen's onLoad event.
Before I go ahead and describe the workflow to you, I would recommend you organize your CRM users using tab groups (this will reduce the amount of work you will have to do later).
Once a tab group has been created and customized to show the essentials to your CRM users, I would follow these steps to create that custom functionality you desire.
Setting up Method
- Create a new field in the Users table which will define the Users Access (I called my field RestrictAccess with a field type of Yes/No)
- To edit this new value, you will have to create a new screen which will allow you to modify the entries in the table.
- Last but not least, create another screen with a label which displays a message to your users that access has been restricted.
Setting up the onLoad event Actions
- Start by retrieving the User Name of the User that is currently logged in
- Then get the RestrictAccess value from the Users table for the user that is currently logged in
- If the value in this field is Yes than we can create a series of conditional statements which will validate the current time
- Retrieve the current time of the session and convert it to the 24hr clock using HH instead of hh for hours
- Using the 24 hour clock, you can then use a series of conditional statements to see if the time is between 09:00 and 17:00 (9am - 5pm)
- If the user logs into Method outside of the pre-determined times, you can take the user to the restricted screen and hide all of the tab links that are associated with that tab.
There is one limitation to this workflow; you are required to customize these onLoad events for the default screen associated with each tab.
For example:
If you were customizing the Leads tab you would have to incorporate the onLoad logic into the Leads and Contacts List Screen.
Happy Customizing!