I have two objects one is standard object (Contact
) and custom (Payment__c
) and they have lookup from Payment__c
to Contact
. My requirement when ever Payment__c
record is created corresponding PaymentConfirmed__c
checkbox on Contact
should be ticked.
I have tried trigger but functionality not working. Can any one help me with this?
TRIGGER:
trigger checkboTrigger on Payment__c(after Insert)
{
List ids = new List(); List conn3 = new List();
for(Payment__c pay: Trigger.new)
{
ids.add(pay.id);
}
List conn2 = [SELECT id ,PaymentConfimed__c from contact where id in: ids];
for(contact conn :conn2)
{
conn.PaymentConfimed__c = true;
conn3.add(conn);
}
update conn3;
}
List<Id> ids = new List<Id>();