Last Updated on April 15, 2019 by Rakesh Gupta
Calendars can do much more than ensuring you are on time for meetings. They can be a central location for project and event materials and knowledge, inform best practices and even assist with corporate administration. You can grant access to your Calendar in Salesforce, by sharing it with users, groups, all users in a role, or roles and their subordinates. You can choose with whom you want to share your calendar as well as how. Let’s do the groundwork first.
Ground Work: – Louis Brooks is working as EMEA Sales Rep at Universal Container. Louis granted, Caroline Bell, an APAC Sales Rep at Universal Container, full access to her Calendar.
To share your calendar, perform the following instructions
- Click on Name | My Settings | Calendar & Reminders | Calendar Sharing
- Click on the Add button to share your Calendar with others.
- Select user Caroline Bell and then, click on Add arrow to move Caroline’s name from the Available column to the Share With column.
- Use the Calendar Access drop‐down to select how you want to share your Calendar. In this case, select Full Access, as shown in the following screenshot
- Once you are done, click on the Save button.
Now onwards, whenever Louis Brooks creates an event, it will be automatically shared with Caroline Bell. Let’s start with a business use case
Business Use Case
Donna Serdula is working as System administrator at Universal Containers. Louis Brooks has assigned a case to Donna Serdula which states that events (only a few, for more details of the event, refer the following diagram) created by her are not visible to user Caroline Bell.
Donna, an Awesome Admin, identified the problem!
Donna searched the Web and found an interesting article about Why can’t I view or edit an Event from a Shared Calendar?
First, concentrate on point 3 (refer the preceding screenshot) and then see image 1. Findings of Donna’s search to resolve the aforementioned problem: Even though Louis Brooks granted Full Access to Caroline Bell to her Calendar, Caroline was able to view the Event on the Calendar but was not able to access Event Detail page because Louis had not populated Related To and/or Name field(s).
Solution of above business requirement
One real use case from Success Community and credit goes to Rhonda Ross. Check out the success community for more details.
Solution #1: – As she has mentioned on the thread, you can solve the need by giving all of those people System Admin access. NOT a good solution.
Solution #2: – Another suggestion, She came up with the idea of using Process Builder to find any event that has both of these fields null and updating the name(WhoId) field with a contact record that could be created for this particular purpose.
We will follow the second approach to solving it. Now take pause here and read the known Issue When shared activities is on, task or event triggers that modify whoId or activity relations may not save correctly
It means if Allow Users to Relate Multiple Contacts to Tasks and Events feature is enabled in an org then
Any trigger that attempts to modify the who_id field on events or tasks OR attempts to add or remove event or task relations that represent related contacts may not save correctly or may not save at all when the trigger is fired during a UI save. The values for whoId or related contacts set in the UI will take precedence over the values set by the trigger.
Means, it is not possible to update Name (WhoId) field in such cases via Trigger or Process Builder. To solve the above business requirement, we will update the Related To (to points an account record) field. This solution will work for all, whether Allow Users to Relate Multiple Contacts to Tasks and Events feature is enabled or not.
- In my next article, I will show you, how to update the Name (WhoId) field when Allow Users to Relate Multiple Contacts to Tasks and Events feature is enabled (Blog 63)
There are few possible solutions for the above business scenario, but we will use the Process Builder to solve it. Follow the below instructions to create a Process for the above business requirement
1. First of all, create an account record with the name Sharing event records.
2. Navigate to Setup | Build | Create | Custom Labels. Click on New Custom Labels, it will open the new window for you. Now create a new custom label to store the account record ID we just created (Account ID for event share), as shown in the following screenshot
3. Our next task is to create a Process Builder on the Event object to update Related To (What ID) if Name and Related To fields are null. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
4. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear where you have to enter the Name (Use Update Related To field as name), API Name and Description as shown in the below screenshot
5. Click on Object node to add object and then select Event object. For the entry criteria, Select only when a record is created, as shown in the below screenshot. Once done, click on the Save button
6. The next task is to add Process Criteria. To do this click on Add Criteria, enter Name, Type of action and set filter conditions as shown in the following screenshot.
- [Event].WhoId Is null Boolean True
- [Event].WhatId Is null Boolean True
7. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Record Updates), and then fill out the fields to define the action, as shown in the following screenshot
The next step is to map Related To ID field with a custom label. To do so select Formula for Type, as shown in the preceding screenshot. Then click on Build a Formula box and select System Variable dialog, as shown in the following screenshot
It will open a popup where you have to select $Label and then select label Account ID for event share, as shown in the following screenshot
Once you’re done click on Choose button. In the end, formula for Related To ID field should look like the following screenshot
Once you’re done click on Use this Formula button.
8. Once done, click on the Save button, it will redirect you to Process canvas. Finally, the Process will look like the following screenshot
Don’t forget to activate the Process by clicking on the Activate button.
It’s time to test the Process
1) Now login from user’s Louis Brooks account, click on Home tab, and navigate to Calendar section, as shown in the following screenshot
2) Now create a new event, make sure to leave Name and Related To field null, as shown in the following screenshot
Once done, click on the Save button. It will open event detail page, as shown in the following screenshot
4) Now login from user’s Caroline Bell account, and try to access event World our Toronto created by Louis Brooks,
Note: – I will suggest you guys, implement this first on your developer/sandbox org, test it and then move it to production.