• dan farris
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi,  I have a trigger that works fine when I insert, update and delete opportunities thru the API.  When I run my test case the aggregateResult list is always empty.  Below is the code.  The code always executes the isEmpty code and won't cover the code below.  The trigger and test case worked fine before and is only having problems due to changes to get the campaign with the most recent close date..

list<aggregateResult> aggResults = [select max(closedate),campaign.name mycamp from opportunity where (campaign.name like 'R/%/NA' or campaign.name like 'R/%/Misc') 
and AccountId = :ContID group by campaign.name order by max(closedate) desc NULLS Last];

If (aggResults.isEmpty())
{
Account test4 = [SELECT Id, Last_Div_Campaign__c, Current_Campaign_Giving__c FROM Account WHERE Id = :ContID];
test4.Current_Campaign_Giving__c = 0;
test4.Last_Div_Campaign__c = null;
update test4;
return;
}


 
I want a billing extract of opportunities with a Remaining Balance.  I also need to list a couple of custom status fields from Contact.  If I select Contact and Opportunity, the report lists duplicate opportunities for Household members.  These do not exist in the Org.  If I just choose Opportunity the output is correct but I need those status fields from Contact.  Any idea how to get the report to output only existing data?
Hi,  I have a trigger that works fine when I insert, update and delete opportunities thru the API.  When I run my test case the aggregateResult list is always empty.  Below is the code.  The code always executes the isEmpty code and won't cover the code below.  The trigger and test case worked fine before and is only having problems due to changes to get the campaign with the most recent close date..

list<aggregateResult> aggResults = [select max(closedate),campaign.name mycamp from opportunity where (campaign.name like 'R/%/NA' or campaign.name like 'R/%/Misc') 
and AccountId = :ContID group by campaign.name order by max(closedate) desc NULLS Last];

If (aggResults.isEmpty())
{
Account test4 = [SELECT Id, Last_Div_Campaign__c, Current_Campaign_Giving__c FROM Account WHERE Id = :ContID];
test4.Current_Campaign_Giving__c = 0;
test4.Last_Div_Campaign__c = null;
update test4;
return;
}