You need to sign in to do that
Don't have an account?
Virturion
Task triggers Opportunity Updates
I've visited this a couple times in the past but never quite got it figured out. Does anyone have a good example of updating an Opportunity field based upon a Task trigger? I need to change the value of a Opportunity pick list based on the Status of a related Task.
Thanks!
Thanks!
If you have code that's doing that, and it's not working, it would be great to take a look at it.
Message Edited by Virturion on 10-27-2008 09:25 AM
* On the Tasks, you are gathering task ids. If you're going to be grabbing opportunities, you probably need to be grabbing WhatId's from the Tasks and not the Task Ids.
* On the Opportunity, you are querying the TaskId's you collected during the first part. This won't work since you're collecting Task Id's.
* On the Opportunity, you are using a " = " operator with a collection. You should be using " IN " instead.
* On the Opportunity, you are assigning the results of a query, a list, to a single object. Right now that's not causing an error since you are collecting TaskIds and not getting any Opportunity hits. You should assign that to some kind of collection.
From a troubleshooting point of view, you might try a System.debug or two in order to display the results of your queries. You can then execute these and view the results. If you do that and aren't seeing the results you know you should, you know you need to go back to the drawing board a bit on your design.
Hope that helps. Cheers.
Did you ever get your code to work? Can you share it?