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
Symone HunterSymone Hunter 

How to restrict events to only allow edit by permission set

I have created calendar events and assigned them based on departments. I also set up permission groups so that people are only allowed to create events for themselves or their departments.I want everyone in the organization to see have access to the other calendars to view but not edit.  I want to set it up so that a person is able to edit their department's events but only view other calendars.



Here is a formula that I have tried
NOT(OR(ISNEW()
IF(OwnerId='Development' && RecordTypeId='Development' &&  $Permission.Calendar_Editing_Development=true, true, false) ||
IF( OwnerId = 'Organizational' && RecordTypeId = 'Organizational' &&  $Permission.Calendar_Editing_Organizational =true, true, false) ||
IF(OwnerId = 'Program Inventory' && RecordTypeId = 'Program_Inventory'  &&  $Permission.Calendar_Editing_Inventory =true, true, false) ||
IF(OwnerId = 'Financial' && RecordTypeId = 'Financial'  &&  $Permission.Calendar_Editing_Financial =true, true, false) ||
IF(OwnerId = 'Evaluation' && RecordTypeId = 'Evaluation' &&  $Permission.Calendar_Editing_Evaluation =true, true, false) ||
IF( OwnerId = 'Board' && RecordTypeId = 'Board' &&  $Permission.Calendar_Editing_Board =true, true, false), true,false))


 
Shri RajShri Raj
the above formula can become quite complex and hard to maintain as the number of departments and permission sets increases. A better approach could be to use a custom field, say "Department" and create a custom metadata type "Department Permission Set" that has two fields, "Department" and "Permission Set" name. Then in your formula use this custom metadata to check if the current user's permission set is allowed to edit events for that department.
Additionally, you can also consider using a combination of sharing rules and field-level security to restrict access to the event fields based on the user's permission set.