Number of Tasks From Lead Owner
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 use our tool Lookup Helper along with Rollup Helper, it is 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, however 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.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
|Duplicate records||Lookup Helper Use Case Library|