• snubby2929
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1

How can I move data from one object to another?  Example, I have a formula field on the child that has a formula value of 4, I want to copy that field value to the parent and display it on the same field name on the parent.  



I am a newbie to triggers and was hoping that someone could help me with this ...Basically I am trying to update a field in my parent object whenever some updates/creates new child records. Below is what I have so far ( both parent and child are custom objects). To make it easier ...this would be like if I have an amount field on the account object and I need to copy the opty amount to this field on the account object. Basically the account amount field should be the sum of all the opty amount fields for the corresponding account ..


trigger License on License_Transfer__c (before update) {

List<DNB_Org__c> dnborgstoupdate = new List <DNB_Org__c>();
for(License_Transfer__c lct : System.Trigger.New) {
 if (lct.License_Type__c == 'UE'){
  DNB_Org__c dnborg = new DNB_Org__c (Id =lct.Holding_Org__c,Holding_Licenses_UE__c = lct.Licenses_to_Transfer__c);