Wednesday, December 2, 2015

Salesforce Activities in a Nutshell


What is Activity?
Activities in Salesforce are the actions you take, for example calls, emails, to-dos.
Activities consist of tasks and events.
Tasks are your to-dos. It has a due date, but not a due time.
Events are events on your calendar. It has both due date and due time. All-day event is an exception, because it doesn’t have a due time.
Although tasks and events are two different standard objects, they are mostly the same behind the scene. You can take them as different record types of activities.
"Who" and "What"
"Who" is the "Name" field of an activity. It refers to a person,  ex. contact or lead. What of an activity is the “related to” field. It refers to an object type things,  ex. account, opportunity, product ...
If Mary has a task "Grab coffee with David from Coca Cola." Then activity "Owner" is Mary. "Who" is contact David. "What” is the account David coming from "Coca Cola".

Activity’s Parent
Activities have "Who", "What" and "Owner" fields. Which one is activity's parent?
The short answer is both "Who" and "What".
Please note that the "parent" relation here is not "master-detail" or "lookup" relationship. Definition of "parent" here is the following:
1. Deleting the "parent" objects will cascade delete the activity.
2. Parent field is not mandatory. An activity can have null "Who" and "What".
3. Sharings of child activities are determined by parents.

Most other Salesforce standard objects have 1 and only 1 parent. However, activity can have multiple parents.

Activities Sharing
Sharing for activities is different from sharing of all other entities. (Thanks Peter Wu for insights about activities sharing.)
When "Org Wide Sharing Settings" is set to the following:
"Controlled by Parent" 
1. 1 "What", 0 "Who": User must have access to the What to see the activity
2. 0 "What", 1 "Who": User must have access to at least 1 Who to see the activity
3. 1 "What", n "Who": User must have access to both the What and at least 1 Who to see the activity.
"Private"
Private sharing for Activities, is actually better named as "Has read-only access if have access to Parents." It's not true private sharing.

“Shared Activities” Perm
Out of the box, one activity can only be associated with 1 "Who". However, turning on "shared activities" allows an activity being associated with multiple "Who"s. For example, if "Mary grab coffee with David and Peter". Then this task is associated with two contacts "David" and "Peter".
When shared activity is enabled, an activity can be “parented” to 1 “What” and up to 50 “Who”s at the same time.
Keep in mind that disable "Shared Activities" is a destructive process. It only keeps the "primary Who" association and removes all extra "who" relationships. Please be very careful about whether you wanna turn on "Shared activities". Never turn off "shared activities" by yourself. Inquire Salesforce support about the risk.

Recurring Events
Creating a recurring event will create a event series and multiple occurrence records. To modify the series events, you must modify the series rather than an occurrence of the event.
When "Advanced Calendaring" perm is on, orgs will see two new columns added to the standard event object. "IsException" and "OriginalInstanceDateTime". Once an occurrence’s "IsException" field is set to true, modify the series will not modify this occurrence. Keep in mind that an occurrence is marked as exception if you modify the subject of this occurrence.

API Tables
In workbench, there are Task and Event tables.
If you turned on “Shared Activities” preference,  two new tables "TaskRelation" "EventRelation" will be added to keep track of the "What", "Who" and "Invitee" relationships.

Activities Archiving
Closed activities due one year ago are automatically archived by Salesforce. Once activities are archived, users should not see them from UI or API. ( System Admin is an exception.) However, Customer can still access these activities via Data export files.  A side note for API, query() call doesn’t return archived activities, queryAll() call does.



1 comment:

  1. Do you happen to have the Salesforce documentation on what describes the Who/What scenarios in your "Activities Sharing" section? Thanks!

    ReplyDelete