You need to sign in to do that
Don't have an account?

AfterUpdate Trigger Has to UpDate the RecoredField With another object RecordField Value
(MY trigger Has to UpDate the RecoredField - Batch_Email__C ''Data Type is--Email For this Field''} the update date must come from the Batch Record .
Note; ((Hear ==="Student =parenet" and "Payment=child" and Batch is 'Parent' to Child="Student")) .
now the Batch_Email__c Field on paymetn Has to Update With the Email in The Batch Record...?
trigger PaymentToBatch on Payment__c (after update)
{
Payment__c paynew=trigger.new[0];
payment__c pay=[select id,Batch_Email__c,student__r.Batch__r.Group_Mail_ID__c From Payment__c
where id=:paynew.id];
system.debug('---pay----'+pay);
system.debug('---payToBatch----'+pay.student__r.Batch__r.Group_Mail_ID__c);
system.debug('---pay.Batch Name----'+pay.Batch_Email__c);
pay.Batch_Email__c=pay.student__r.Batch__r.Group_Mail_ID__c;
system.debug('---payTOBatch.After----'+pay.Batch_Email__c);
}
Result:
In My Developer Console the out put is Shown But my ''Batch_Email__c' 'Field on Payment Is Not Showing the OutPut value.
1. Change the trigger event to before update instead of after update
2. Change this statement to use paynew.Batch_Email__c
pay.Batch_Email__c=pay.student__r.Batch__r.Group_Mail_ID__c
to
paynew.Batch_Email__c=pay.student__r.Batch__r.Group_Mail_ID__c
Above two change should work for you.
Your trigger is not supported for bulk handling, you need to bulkify it.
All Answers
1. Change the trigger event to before update instead of after update
2. Change this statement to use paynew.Batch_Email__c
pay.Batch_Email__c=pay.student__r.Batch__r.Group_Mail_ID__c
to
paynew.Batch_Email__c=pay.student__r.Batch__r.Group_Mail_ID__c
Above two change should work for you.
Your trigger is not supported for bulk handling, you need to bulkify it.
Thanks For ur Answers its working .....
But I need to Do the same logic in " After Update".