Skip to main content
Our inside sales reps will sometimes email new leads without accepting them from the queue . Our reps' emails are automatically logged through iHance. I would like this activity history to update the owner to the activity owner if the lead is in a queue.

 

Can you reccommend a way to update this field? Is this a cross-object formula that would require an apex trigger?

 

Thank you!
1 Antwort
  1. 18. Sept., 21:07

    Hi Orian,

    A cross-object formula won't work for this because Lead Owner is a field that needs to be updated, not just calculated. 

     

    Since the email activity is being created by iHance, an Apex trigger on Task would be a good option. When a Task is created:

    1. Check whether Task.WhatId is a Lead.
    2. Check whether the Lead is currently owned by a Queue.
    3. If so, use Task.OwnerId to update the Lead's OwnerId.
    4. Make sure the trigger is bulkified since iHance may create multiple activities at once.

    You could also use Workflow/Process automation if the required Task and Lead fields are available, but Apex gives you more control over the queue check and owner update. 

     

    If you can share how iHance populates the Task fields, especially OwnerId and WhoId/WhatId, the exact trigger logic can be determined.

0/9000