You need to sign in to do that
Don't have an account?
Nalec7
Apex Code? Days Since Last Activity Type
I have a custom contact field called Days Since Last Activity - Today()- LastActivityDate. However, the new business requirement is to only calculate Days Since Last Outgoing Call Types. The activity picklist values are Outgoing Email, Outgoing Call, Outgoing - Call Hit
In Summer '14, you can access activity dates in formulas however you can not access activity/task types. I also tried workflows, no luck.
My understanding now is this must be done with a apex trigger. It would evaluate the Call type field and update the Custom field if the criteria is met. Does anyone any simular code that can be used?
Thanks, Chris
In Summer '14, you can access activity dates in formulas however you can not access activity/task types. I also tried workflows, no luck.
My understanding now is this must be done with a apex trigger. It would evaluate the Call type field and update the Custom field if the criteria is met. Does anyone any simular code that can be used?
Thanks, Chris
The basic idea here, is to generate a single query, which when run, returns the date of the last outgoing call.
This is a particularlly tricky bit, because the tasks and events fields are polymorphic in Salesforce. Yay.
Here's a helpful diagram: https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_erd_activities.htm
this is the start of a query.