You need to sign in to do that
Don't have an account?
hegde_hegdek
Trigger not able to find reference of maste object
Hello Freinds,
I have a trigger on a child object,in this trigger i need to find reference to the master object,
But i am not able to get it ,it is always null.
regards
kaushik
Try removing the . between account and ID, e.g.
acc = [select Id,name from Account where Id =pp.AccountID];
All Answers
Account is the master and opportunity is the child,whenever the opportunity feild status is changed i need to change the account status,so i am writing a trigger for opportunity to reference account and change status
trigger Account_Status_UPD on Opportunity (after insert,after update) {
Account acc;
Opportunity opr = new Opportunity();
for (Opportunity opp : Trigger.old) {
acc = [select Id,name from Account where Id =:opp.Account.ID];
//It throws an exception select itself as the opp.Account feild is null
}
}
Try removing the . between account and ID, e.g.
acc = [select Id,name from Account where Id =pp.AccountID];