• edrickwong
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 10
    Replies

Hi All,

 

I'm very brand new to apex coding and need a little help creating a trigger that will update a picklist field (Occupied_Status__c) from one custom object (Inspection_Checklist__c) to another custom object (Property_Evaluation__c) only when another field is TRUE in the original object that is being updated (Inspection_Checklist__c.Inspection_Complete__c = TRUE).

 

Below is the code I've created so far, I might be completely off, but any help would be appreciated. Thanks in advance! 

 

Right now I'm getting the following error in line 6: Save error: unexpected token: ':'

 

 

trigger OccupancyStatus on Inspection_Checklist__c (after update) {
	
	List<Property_Evaluation__c> eval =
	    [SELECT j.Occupied_Status__c
	     FROM Inspection_Checklist__c j
	     WHERE j.Inspection_Checklist__c.Inspection_Complete__c = TRUE : Trigger.new
	      FOR UPDATE];
	      
	for (Property_Evaluation__c li: eval){
		li.Occupied_Status__c=li.Inspection_Checklist__r.Occupied_Status__c;
	}
    update eval;
}

 

 

 

 

Hi All,

 

I'm very brand new to apex coding and need a little help creating a trigger that will update a picklist field (Occupied_Status__c) from one custom object (Inspection_Checklist__c) to another custom object (Property_Evaluation__c) only when another field is TRUE in the original object that is being updated (Inspection_Checklist__c.Inspection_Complete__c = TRUE).

 

Below is the code I've created so far, I might be completely off, but any help would be appreciated. Thanks in advance! 

 

Right now I'm getting the following error in line 6: Save error: unexpected token: ':'

 

 

trigger OccupancyStatus on Inspection_Checklist__c (after update) {
	
	List<Property_Evaluation__c> eval =
	    [SELECT j.Occupied_Status__c
	     FROM Inspection_Checklist__c j
	     WHERE j.Inspection_Checklist__c.Inspection_Complete__c = TRUE : Trigger.new
	      FOR UPDATE];
	      
	for (Property_Evaluation__c li: eval){
		li.Occupied_Status__c=li.Inspection_Checklist__r.Occupied_Status__c;
	}
    update eval;
}