The hands-on training is based on the default developer edition organization and has some customizations that must be done prior to starting with the rest of the exercises
High and NormalMake this value the default for the master picklistNumber and click NextCase LayoutBusiness Hours to the case layoutBusiness Hours field onto the page layoutTextCase Number: {!Case.CaseNumber}
Subject: {!Case.Subject}CaseCommentCount triggertrigger CaseCommentCount on CaseComment (after insert, after delete) {
Set<Id> ownerIds = new Set<Id>();
Set<Id> caseIds = new Set<Id>();
Map<Id, Integer> commentCount = new Map<Id, Integer>();
List<CaseComment> comments = (Trigger.isInsert) ?
Trigger.new : Trigger.old;
for (CaseComment cc : comments) {
caseIds.add(cc.ParentId);
commentCount.put(cc.ParentId, 0);
}
for (Case c : [select OwnerId from Case where Id in :caseIds]) {
ownerIds.add(c.OwnerId);
}
for (CaseComment cc : [
select CreatedById,
ParentId
from CaseComment
where ParentId in :caseIds and
CreatedById in :ownerIds
]) {
commentCount.put(cc.ParentId,
commentCount.get(cc.ParentId) + 1
);
}
List<Case> casesToUpdate = new List<Case>();
for (Id id : commentCount.keySet()) {
casesToUpdate.add(new Case(
Id = id,
Owner_Comment_Count__c = commentCount.get(id)
));
}
update casesToUpdate;
}