You need to sign in to do that
Don't have an account?
what is wrong in this code
this code below works fine and throws error when case team is not there when status is changed per code.
however it still throws error when someone updates case and case team is there, what is wrong here?
thanks
//start ***** checks if case team is there, if not, wont allow change of status
public void caseteam(){
setCaseId = new Set<Id>();
for (Case c : mescal){
if(c.Status != moldmap.get(c.Id).Status && c.Record_Type_Name__c=='Escalation'
&& (c.status == 'Active Engaged' || c.status == 'Active Wait' || c.status == 'Analysis'||
c.status == 'Closed'))
{
setCaseId.add(c.Id);
}
}
mapCaseWithteamMember = new Map<Id,CaseTeamMember>();
if(!(setCaseId.ISEMPTY())){
for(CaseTeamMember ct: [SELECT Parentid FROM CaseTeamMember WHERE parentid IN :setCaseId])
{mapCaseWithteamMember.put(ct.ParentId,ct);}
}
if(mapCaseWithTeamMember.ISEMPTY()){
for(Case c: mescal)
{
if(mapCaseWithTeamMember.get(c.Id) ==null && c.Record_Type_Name__c=='Escalation' &&
(c.status == 'Active Engaged' || c.status == 'Active Wait' || c.status == 'Analysis'||
c.status == 'Closed'))
{
c.addError('No case team is assigned, please assign a team member before changing status');
}
}
}
}
//end ------------------------------------------
try this.
All Answers
try this.
also other way to avoid was add
if(setCaseId.ISEMPTY()) return; and that works too.
Thanks a lot.