• Damodhar Reddy 7
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,
This is Vamsi need one help friends
I wrote a trigger to upadte parent record while child got created. But it is not working can yoy guide me.

trigger InTri on APEX_Invoice__c (after insert) {

List<APEX_Invoice__c> inn = new List<APEX_Invoice__c>();
List<APEX_Customer__c> cuu = new List<APEX_Customer__c>();
    List<APEX_Customer__c> cus = new List<APEX_Customer__c>();
    List<ID> ids = new List<ID>();
    for(APEX_Invoice__c obj1:Trigger.new)
    {
        ids.add(obj1.APEX_Customer__r.id);
    }
cuu = [SELECT id,Name,APEX_Customer_Status__c FROM APEX_Customer__c WHERE ID IN: ids];
for(APEX_Customer__c obj:cuu)
{
obj.APEX_Customer_Status__c = 'Paid';
   cus.add(obj); 
}
 update cus; 
}