<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using WhatId to find Opportunities associated with Activities</title>
	<atom:link href="http://theEnforcer.net/2010/07/using-whatid-to-find-opportunities-associated-with-activities/feed/" rel="self" type="application/rss+xml" />
	<link>http://theEnforcer.net/2010/07/using-whatid-to-find-opportunities-associated-with-activities/</link>
	<description>a force.com blog</description>
	<lastBuildDate>Tue, 17 Jan 2012 23:35:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
	<item>
		<title>By: The Enforcer</title>
		<link>http://theEnforcer.net/2010/07/using-whatid-to-find-opportunities-associated-with-activities/comment-page-1/#comment-71150</link>
		<dc:creator>The Enforcer</dc:creator>
		<pubDate>Tue, 20 Jul 2010 15:38:42 +0000</pubDate>
		<guid isPermaLink="false">http://theEnforcer.net/?p=252#comment-71150</guid>
		<description>@mkaufman Ah! The good old Nested Select trick! Very clever!</description>
		<content:encoded><![CDATA[<p>@mkaufman Ah! The good old Nested Select trick! Very clever!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Kaufman</title>
		<link>http://theEnforcer.net/2010/07/using-whatid-to-find-opportunities-associated-with-activities/comment-page-1/#comment-71149</link>
		<dc:creator>Matt Kaufman</dc:creator>
		<pubDate>Tue, 20 Jul 2010 15:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://theEnforcer.net/?p=252#comment-71149</guid>
		<description>Actually, you could do this with only 1 query as follows:

List taskUpdates = new List();
for ( Opportunity o : [Select Id, OwnerId, (Select Id, OwnerId from Tasks where Status != &#039;Completed&#039; ) from Opportunity ){
for ( Task t : o.Tasks ){
if ( t.OwnerId != o.OwnerId ){
t.Status = &#039;Completed&#039;;
taskUpdates.add(t);
}
}
}
update taskUpdates;</description>
		<content:encoded><![CDATA[<p>Actually, you could do this with only 1 query as follows:</p>
<p>List taskUpdates = new List();<br />
for ( Opportunity o : [Select Id, OwnerId, (Select Id, OwnerId from Tasks where Status != &#8216;Completed&#8217; ) from Opportunity ){<br />
for ( Task t : o.Tasks ){<br />
if ( t.OwnerId != o.OwnerId ){<br />
t.Status = &#8216;Completed&#8217;;<br />
taskUpdates.add(t);<br />
}<br />
}<br />
}<br />
update taskUpdates;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

