Name
sn_customerservice.CSMCaseTaskManagementImpl
Description
Implements extension point sn_customerservice.CaseTaskExtensionPoint Designed to configure access to the parent Case
Script
var CSMCaseTaskManagementImpl = Class.create();
CSMCaseTaskManagementImpl.prototype = {
initialize: function() {
},
/**
* Conditional checks for a user to be added to the contributor field on the Case
* Condition - user needs to have sn_customerservice.case_task_agent role
*/
canUserBeAddedToContributorList: function(userId){
var userGr = new GlideAggregate("sys_user_has_role");
userGr.addEncodedQuery("role.name=sn_customerservice.case_task_agent^user=" + userId);
userGr.addAggregate("COUNT");
userGr.query();
if (userGr.next()){
if(userGr.getAggregate("COUNT") > 0)
return true;
}
return false;
},
/**
* Conditional checks for a group to be added to the contributor field on the Case
* Condition - all groups can be added
*/
canGroupBeAddedToContributorList: function(groupId){
return true;
},
/**
* Conditional checks for a user to be removed from the contributor field on the Case
* Condition - User should not have any associated case task assigned to them
*/
canUserBeRemovedFromContributorList: function(caseId, userId){
var caseTaskGr = new GlideAggregate("sn_customerservice_task");
caseTaskGr.addEncodedQuery("parent=" + caseId + "^assigned_to=" + userId);
caseTaskGr.addAggregate("COUNT");
caseTaskGr.query();
if (caseTaskGr.next()) {
if (caseTaskGr.getAggregate("COUNT") > 0)
return false;
}
return true;
},
/**
* Conditional checks for a group to be removed from the contributor field on the Case
* Condition - Group should not have any associated case task assigned to them
*/
canGroupBeRemovedFromContributorList: function(caseId, groupId){
var caseTaskGr = new GlideAggregate("sn_customerservice_task");
caseTaskGr.addEncodedQuery("parent=" + caseId + "^assignment_group=" + groupId);
caseTaskGr.addAggregate("COUNT");
caseTaskGr.query();
if (caseTaskGr.next()) {
var task_count = caseTaskGr.getAggregate("COUNT");
if (task_count > 0)
return false;
}
return true;
},
type: 'CSMCaseTaskManagementImpl'
};
Sys ID
7a3719080f2a10105bc5e7b1d4767e94