• SgtKiller
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
This is probably a very basic question. I'm new to programming and have spend 2 hours on this.
I'm trying to do a cross object field update trigger stamping one object with the CreatedDate of the other object.
The update field on the object I'm trying to update is of type Date.
trigger UpdateQSOCreatedDate on FRLS_Round__c (after insert) {
  	List<ID> QSOTargetIds = New List<ID>();

  for(FRLS_Round__c r : Trigger.new){
    if(r.QSO_Target__c!=null){
      QSOTargetIds.add(r.QSO_Target__c);
    }
  }

  List<QSO_Target__c> QSOTargetList = [SELECT id, Date_Last_Round_Created__c FROM QSO_Target__c WHERE id in :QSOTargetIds];
  for(integer i = 0 ; i < QSOTargetList.size(); i++){
  QSOTargetList[i].Date_Last_Round_Created__c = FRLS_Round__c.CreatedDate;
  }
  update QSOTargetList;
}


How do you convert CreatedDate to a Date field?