+ Start a Discussion
Sindhu AmbarkarSindhu Ambarkar 

Trigger for junction object


I have 3 objects A,B and C .B is the junction object between A and C.How to get the C records from A.Please help with code.

Thanks & Regards,
Sindhu Ambarkar.
srlawr uksrlawr uk
So here you would want to make use of a simple SOQL query... assuming you are in a block of code where you have "A" ...  You could use
List<B__c> bees = [SELECT C__c.Id FROM B__c WHERE A__c = :aId];
List<C__c> cees = new List<C__c>();
for(B__c thisB : bees) {
    cees.add(new C__c(Id=thisB.C__c));

tht will fundamentally give you a list of C objects from that A