Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write an Apex trigger that makes a field on the Contact called Meeting Date equal to the Meeting Date field on the Opportunity. For some reason I'm getting an error saying "Expression cannot be assigned at line -1 column -1". Which apparently means that the SOQL query isn't pulling any information?

Very new to Apex/Coding so any guidance helps.


trigger updateMeetingDate on Contact (before update) {

  List<Opportunity> newOppList = [Select Opportunity.Meeting_Date__c
                  From Opportunity
                  Where Opportunity.Type = 'New Business'
                      And(Opportunity.StageName = 'TQL' OR Opportunity.StageName = 'SAL')
   if(Contact.Open_Opportunity_Count__c = 1){
   Contact.Meeting_Date__c = Opportunity.Meeting_Date__c; 
share|improve this question

You have an assignment expression, using the assignment operator (single equals =) where a Boolean expression is expected.

if(Contact.Open_Opportunity_Count__c = 1)

You should use the equality operator (double equals ==) instead to test equality.

if(Contact.Open_Opportunity_Count__c == 1)

See Understanding Expression Operators for the official documentation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.