You need to sign in to do that
Don't have an account?
Manpreet Singh 207
Wrote trigger to block case creation with specific Subject line
Hello All - We have created below mentioned trigger to block emails from creating cases with specific subject lines
trigger manageEmailCases on Case (before insert) {
List<String> oooSubjects=new List<String>{'OOO','ooo','Automatic Reply','automatic reply','Automatic reply'};
for(Case thisCase : trigger.new) {
if(thisCase.Origin == 'Email') {
// String sub = thisCase.Subject;
String s = thisCase.Subject;
if(oooSubjects.contains(s)) {
}
}
{
thisCase.description.addError('Not saving e2c');
}
}
}
However, it has blocked an email from case creation with subject 'on line classes'. What could be the issue here?
trigger manageEmailCases on Case (before insert) {
List<String> oooSubjects=new List<String>{'OOO','ooo','Automatic Reply','automatic reply','Automatic reply'};
for(Case thisCase : trigger.new) {
if(thisCase.Origin == 'Email') {
// String sub = thisCase.Subject;
String s = thisCase.Subject;
if(oooSubjects.contains(s)) {
}
}
{
thisCase.description.addError('Not saving e2c');
}
}
}
However, it has blocked an email from case creation with subject 'on line classes'. What could be the issue here?
trigger manageEmailCases on Case (before insert) {
List<String> oooSubjects=new List<String>{'OOO','ooo','Automatic Reply','automatic reply','Automatic reply'};
for(Case thisCase : trigger.new) {
if(thisCase.Origin == 'Email') {
// String sub = thisCase.Subject;
String s = thisCase.Subject;
if(oooSubjects.contains(s)) {
thisCase.description.addError('Not saving e2c');
}
}
}
}
All Answers
This trigger might be causing the issue or there could be custom validation rule that might be set up that might be preventing from the cse creation to check what you could do is set the debug logs on default case owner and try replicating the scenario then after following the steps you can check the debug logs to check what might be causing the issue.
In case if this helps please close the thread by marking a best answer so that it can be helpful to others in the future and also helps in keeping the community clean.
Regards,
Anutej
trigger manageEmailCases on Case (before insert) {
List<String> oooSubjects=new List<String>{'OOO','ooo','Automatic Reply','automatic reply','Automatic reply'};
for(Case thisCase : trigger.new) {
if(thisCase.Origin == 'Email') {
// String sub = thisCase.Subject;
String s = thisCase.Subject;
if(oooSubjects.contains(s)) {
thisCase.description.addError('Not saving e2c');
}
}
}
}