• NPnp
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi,

 

I have 2 objects, one custom object CustomEvent__c and another salesforce's event object.

I want the objects are same when CustomEvent__c is updated.

 

The trigger can be fired. But the data is not updated.

please help me to write a code for update.

 

the code is below.

 

 

trigger UpdtEvent on CustomEvent__c (before Update) {

    for (CustomEvent__c ce: Trigger.New){
        Event e = [select id from Event where CustomEventID__c =: ce.id];
            e.OWNERID = ce.OWNERID;
            e.SUBJECT = ce.NAME;
            e.ToDoType__c = ce.ToDoType__c;
            e.SubTypeCD__c = ce.SubTypeCD__c;
            e.ParticipationNum__c = ce.ParticipationNum__c;
            e.Description = ce.Note__c;
            e.WHOID = ce.ContactName2__c;
            e.WHATID = ce.AccountName2__c;
            e.CalledStatus__c = ce.CalledStatus__c;
            e.STARTDATETIME = ce.CALLSTARTTM__C;
            e.ENDDATETIME = ce.CALLENDTM__C;   
  }
}

  • September 04, 2012
  • Like
  • 0