I am writing a query that calculate and NPS Score on the Account record. There is an NPS custom object related to the Account object through a master-detail relationship. How do I link the account record to the NPS custom object such that I can do a count etc of those objects which are related to a certain account? Right now this is the base of my trigger, how would I go about accessing the child records? I've tried some SOQL queries but it doesn't seem to work. I'm not sure if there is something specific i have to do for parent-child relationships
trigger CalculateNPS on Account (before update) {
for(Account a : trigger.new){
List<NPS> nps= new List<NPS>();
nps = [SELECT Id FROM NPS__c WHERE =: a.Id];
a.NPS_Score_Trigger__c = 2;
}
}