I have a new trigger and when I try to deploy I get the above error. I know this due to SELECT statement. I tried with List object but still got that error.
Thanks in advance Jay
trigger TAFieldUpdate on Training_Plan__c (after insert, after update) {
for (Training_Plan__c TP : Trigger.new) {
Training_Agreement__c TA = [SELECT Programme__c, Expected_Completion__c, MA_Anticipated_End_Date__c,
Complex_Modern_Apprenticeship_Programme__r.Program__r.Name,
Achieved_Credit_2015__c
From Training_Agreement__c
WHERE ID = :TP.Training_Agreement__c];
If((TP.Funding__c == 'IT - Industry Training') && (TP.TEC_Status__c == 'Active'
|| TP.TEC_Status__c == 'Complete'
|| TP.TEC_Status__c == 'On Hold'
|| TP.TEC_Status__c == 'Withdrawn'
|| TP.TEC_Status__c == 'Pending Transfer')) {
//TA.Programme__c = TP.Program_Version__r.Program__r.Name;
TA.Programme__c = TP.Program_Name__c;
TA.Expected_Completion__c = TP.Expected_Completion__c;
TA.Achieved_Credit_2015__c = TP.Achieved_Credit_2015__c;
Update TA;
}
else if (TP.Funding__c == 'MA - Modern Apprenticeship' || TP.Funding__c == 'NZA - New Zealand Apprenticeship') {
//TA.Programme__c = TA.CMA_Program_Name__c;
TA.Programme__c = TA.Complex_Modern_Apprenticeship_Programme__r.Program__r.Name;
TA.Expected_Completion__c = TA.MA_Anticipated_End_Date__c;
Update TA;
} else if (TP.Funding__c == 'UF - Un-funded' && TP.Non_TEC_Funded_Status__c == 'Active') {
TA.Programme__c = TP.Program_Name__c;
//TA.Programme__c = TP.Program_Version__r.Program__r.Name;
Update TA;
}
}
}