You need to sign in to do that
Don't have an account?
update status based on realted list
Hi team,
I have written a trigger to update status on case
Note : If none of apporval not accept case status need to became reject
trigger updatestaus1 on Case_Approval_Tracker__c(after update) {Set <ID> case_ids = new Set <ID>();
for(Case_Approval_Tracker__c c : Trigger.new) {
case_ids.add(c.caseid);
}
List <Case> caList = [SELECT Id, Status, (SELECT Id,Approval_Status__c FROM Case_Approval_Tracker__c) FROM Case WHERE Id IN : case_ids];
for(Case a : caList){
integer count=0;
for(Case_Approval_Tracker__c c : a.Case_Approval_Tracker__c ){
if(c.Approval_Status__c == 'Approved'){
a.Status = 'Approved';
}
else{
a.Status = 'Rejected';
}
if(a.Case_Approval_Tracker__c.size()==count){
a.Status = 'Rejected';
}
}
update caList;
}
}
Error :
(SELECT Id,Approval_Status__c FROM Case_Approval_Tracker__c) FROM Case
^
ERROR at Row:1:Column:55
Didn't understand relationship 'Case_Approval_Tracker__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Help me to fix error :)
I have written a trigger to update status on case
Note : If none of apporval not accept case status need to became reject
trigger updatestaus1 on Case_Approval_Tracker__c(after update) {Set <ID> case_ids = new Set <ID>();
for(Case_Approval_Tracker__c c : Trigger.new) {
case_ids.add(c.caseid);
}
List <Case> caList = [SELECT Id, Status, (SELECT Id,Approval_Status__c FROM Case_Approval_Tracker__c) FROM Case WHERE Id IN : case_ids];
for(Case a : caList){
integer count=0;
for(Case_Approval_Tracker__c c : a.Case_Approval_Tracker__c ){
if(c.Approval_Status__c == 'Approved'){
a.Status = 'Approved';
}
else{
a.Status = 'Rejected';
}
if(a.Case_Approval_Tracker__c.size()==count){
a.Status = 'Rejected';
}
}
update caList;
}
}
Error :
(SELECT Id,Approval_Status__c FROM Case_Approval_Tracker__c) FROM Case
^
ERROR at Row:1:Column:55
Didn't understand relationship 'Case_Approval_Tracker__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Help me to fix error :)
or check name of relationship of Case lookup in Case_Approval_Tracker__c object
line 4 : case_ids.add(c.caseid); Error : Variable does not exist: caseid
line 11 : for(Case_Approval_Tracker__c c : a.Case_Approval_Tracker__c ){ Error : Variable does not exist: Case_Approval_Tracker__c
please help me reslove Case_Approval_Tracker__c (is custom object is correct )
for(Case_Approval_Tracker__c c : a.Case_Approval_Tracker__r ){