Problem: Because of Salesforce limitations with the standard relationship between Task and Lead, this use case gets a bit complicated, but with the use of our tool Lookup Helper along with Rollup Helper, it's possible to accomplish this!
To explain this limitation further, this use case requires you to compare the owner of Task, to the owner of the Lead, on the Task Object.
In order to do this, you have to refer to the related Lead record to obtain the owner, and compare it to the owner on the Task in a checkbox formula field. This would be done through a Cross-Object reference; the default relationship here is WhoId. WhoId is a special relationship field that is polymorphic, meaning it can point to different Objects. Because of this, Salesforce does not allow Cross-Object references.
Solution: In order to get past this limitation, you can use our tool Lookup Helper to create a new relationship between Task and Lead, which can support a Cross-Object reference.
First, you will want to install our app Lookup Helper from the AppExchange, which allows for two settings in the free version. For this use case you will only need to use one.
- You will want to create your target field in Salesforce. We can called it LH_Lead_Lookup__c for example.
This will be a Lookup field on the Task Object, which looks up to the Lead Object.
- Once this field is created you can create your Lookup Helper setting.
- The first choice of creating the setting will be the Object that has the Lookup field on it. This will be the Task Object.
- Then you will select the Lookup field you want to populate, which will be the newly created lookup field between Task and Lead. The example name provided was: LH_Lead_Lookup__c
- The child Object matching field will be WhoId, the Parent Object field will be Name/Id.
What this will do is take the existing relationship field Whoid, and copy the id in that field into your new lead lookup field. If the id is for something other than a lead, it will leave the lead lookup field blank.
- You will want to manually run this setting, and you should not have to deploy a trigger to have it run in real-time.
- Once you have this new relationship, you can now create a formula field on the Task Object. This formula will return a checkbox that is marked true when the Lead owner Matches Task Owner.
The formula will look similar to:
OwnerID = LH_Lead_Lookup__r.OwnerId
- Now that you have a checkbox that will return true when the Task and Lead Owner are the same, you can add this in a filter for a rollup that counts the number of tasks under the lead where this new formula checkbox = true.
- In Rollup Helper, the target Object will be Lead
- Choose or create your target Field
- Child Object is Tasks
- Type of rollup is Count
- Create filter criteria where the new formula checkbox = true
|Identify and Eliminate Duplicate Records||Lookup Helper Use Case Library||Link Child Accounts to Ultimate Parent Account in Salesforce|