• Jon Plyley
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hello everyone, I am writing a utility class for a trigger. I'm trying to execute a SOQL query that pulls all opportunities, then filters them out by start date and by specific types of classifications. So, the objects that I'm using are: opportunities, contacts, and a custom object called classification type contacts. 

I need to filter out the opportunities by specific classification type contacts. 

The relationships are as follows: 
  • opportunities has a lookup field called "donors" that relates it to contacts
  • contacts has a master-detail relationship with "classification_type_contacts__c"
So far, my SOQL query looks as follows:
 
String classNames = getAggregateDataUtils.getClassNames('Majors'); //utility method to return string of names to filter by
Date startDate = Date.newInstance(2018, 11, 27);
Date endDate = Date.newInstance(2018, 11, 28);
List<Opportunity> opps = [SELECT opp.id, opp.CloseDate, opp.amount, (SELECT Classification_Name__c FROM Classification_Type_Contact__c) FROM Opportunity opp
                          WHERE (opp.CloseDate >=: startDate and opp.CloseDate <=: endDate)
                          AND classification_name__c IN : classNames];
The error I get is as follows:

User-added image


I'm not really sure how to fix this. I think the biggest problem is that there's no lookup field on the Contact to the "Classification_Type_Contact__c", but since there's a Master-Detail relationship, I should still be able to get there, right? I can pull reports with a custom report type that relates the three different objects. 

Thank you in advance for your help!


Best,
Jon
 
I'm trying to create a validation rule on the contact that checks to see if:

1: there is a task associated with that contact
2: if the subject line of the task matches a given string.

However, I just can't figure out what field to use in the formula editor for the validation rule. Is this even possible?

Thank you in advance for any replies or advice!
I'm trying to create a validation rule on the contact that checks to see if:

1: there is a task associated with that contact
2: if the subject line of the task matches a given string.

However, I just can't figure out what field to use in the formula editor for the validation rule. Is this even possible?

Thank you in advance for any replies or advice!