You need to sign in to do that
Don't have an account?
bryansosa01
Summarize form CustomObject1 and save results into CustomObject2
I want to make a trigger that summarizes field_A from CustomObject1 and save the result into Field_B from CustomObject2.
These objects are NOT related.
Can someone give me an example?
i.e. on which condition you want to summarize that field?
because both objects are not related then there should be some logic to get records of customobject2 based on some values of customobject1. Please give some more details.
I have two custom Objects with the following fields:
CustomObject1 with the fields Amount and Date1
CustomObject2 with the fields TotalAmount and Date 2
What I want to make is a trigger that summarizes CustomObject1.Amount and save the result into CustomObject2.TotalAmount where CustomObject1.Date1 = CustomObject2.Date2
CustomObject1 and CustomObject2 are NOT related.
I would really appreciate your help. Thanks.
Hi,
Try below Trigger.
Hi,
Try the following trigger,
trigger CreateObj2 on customobject1__c (after insert) {
for(Customobject1__c c1 : Trigger.new){
Customobject2__c c2 = new Customobject2__c(TotalAmount__c = c1.Amount__c, Date2__c = c1.Date1__c);
insert c2;
}
}
this will create a new record in customobject2 if a customobject1 record is created.
Hope this will help you...!