function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DT DeveloperDT Developer 

Transfering Data from a Contract to Account

Is there a way to transfer data from a Contract to a Account?  The issue we are having is that we need to know if the setup for a Contract that is attached to a Account is Completed.  We currently have a check box on the Contract called "Name of Product" Setup Completed and need that data to show up on the Account.
 
Thanks,
Howard
DT DeveloperDT Developer
After a hour of hammering this thing down think I got it:

trigger ContractUpdate on Contract (after update) {

 List<Account> accountsToUpdate = new List<Account>();
 for (Contract c:System.Trigger.new) {
  if ((c.Stage__c=='Completed') && (c.eCon_Completed__c=='Yes')) {
   Account acc = new Account(Id=c.Account_ID__c,eCon_Completed__c=TRUE);
   accountsToUpdate.add(acc);
  }
 }
 update accountsToUpdate;
}

Now my question is how do I create the code to test this trigger?

Thanks,
Howard


Message Edited by DT Developer on 09-13-2008 06:30 PM

Message Edited by DT Developer on 09-13-2008 07:02 PM