• Raja Islam
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I'm working through Apex & .NET Basics - Understanding Execution Context

When validating the challenge I'm getting the error:
 
Challenge Not yet complete... here's what's wrong: 
The Trigger 'AccountTrigger' does not appear to be calling the AccountTriggerHandler class correctly or using isBefore or isInsert content variables.

The trigger I currently have is minimal:

trigger AccountTrigger on Account (before insert) {
    AccountTriggerHandler.CreateAccounts(Trigger.new);
}

Why would I need to check Trigger.isBefore and Trigger.isInsert if the trigger is only on before insert?

 
Is this the expected behavior of the function containsOnly()?
String foo = 'garbage';		
foo.containsOnly('junk');     //This returns false

String foo = '';		
foo.containsOnly('junk');      //This returns true

system.assertEquals(foo, 'junk');   //This will fail
Seems like a bug but maybe I am missing something.
 

Im relatively new to Database queries, but the situation is for a little while we had an online scripts creating creating duplicate entries for the contact role in each opportunity created. That problem was fixed but now I just need to create a SOQL report of just the duplicates so I can go through and delete one of each.

This is the SOQL Query I try:

 

select ID, ContactID, OpportunityIDCOUNT(OpportunityID)

from OpportunityContactRole 

where Role != NULL

GROUP BY OpportunityID

HAVING COUNT(OpportunityID) > 1

 

This is returning the error:

 

MALFORMED_QUERY:
ContactID, OpportunityID, COUNT(OpportunityID)
^
ERROR at Row:1:Column:40
Grouped field should not be aggregated: OpportunityId

 

Can someone help me with this?

 

  • July 23, 2013
  • Like
  • 0