You need to sign in to do that
Don't have an account?

Pull completed date value from task and update a field with the value on account
Hi everyone, I could really use some help with a trigger I'm trying to make. I essentially need a field on the account object to be populated with the latest completed task date if it meets two conditions:
1. The task has been marked as completed
2. The task field "Spoke_with__c" equals Yes
I tried to take a stab at it but I couldn't get the code to compile. Sample code to get me going would be greatly appreciated.
Here are the variables-
Task custom field (picklist)- Spoke_With__c
Account custom field (date/time)- Last_SW_Activity__c
Thanks!
Try this out, kick the tires, and see if it works.
Thanks sfdcfox, I appreciate your help. This didn't actually work out for me, it compiles but doesn't function. Instead of using the "Spoke_With__c" filter we can use the filter of "starts with sw". However I'm not sure what the operation for "starts with" is. In other words "and Subject starts with sw".
Thanks again for your help I appreciate it.
That would be something like:
The "%" is a "wildcard", meaning it matches any number of characters (even none at all), so this is how you would implement "starts with."
Thanks for the help fox. I tried tweaking the code but I still couldn't get this to work. I ended up starting from scratch (trying to get some experience developing with apex since I'm new to it) and I think I'm pretty close. If anyone can please take a look at my code and help me out I would appreciate it.
The error I'm getting states "Invalid field endDatetime for SObject Task". It's refering to the last line of code. Does anybody have any idea why it's giving me that error?