You need to sign in to do that
Don't have an account?
fiona gentry
Resolve Trigger Error For Trigger when Email subject is AIRTEL
Dear Folks,
I have a queue named "Prepaid" and want to route Email 2 case to a particular Prepaid Queue when emails contains "Airtel" in Subject
Wrote a Trigger for Email 2 case queue such that it triggers when Email subject is AIRTEL(Space Before and After)
Step 1:
Created below Custom Label with string to match against. As I want to route emails which contains Airtel in Subject to a above Prepaid queue
EmailSubjectAsw = “Airtel”
Step 2:
Created Case Trigger (beforeInsert) and used this code snippet below:
Getting Error as
Can some one provide resolution above and fix the Trigger code
Thanks In Advance,your help is appreciated
Fiona
I have a queue named "Prepaid" and want to route Email 2 case to a particular Prepaid Queue when emails contains "Airtel" in Subject
Wrote a Trigger for Email 2 case queue such that it triggers when Email subject is AIRTEL(Space Before and After)
Step 1:
Created below Custom Label with string to match against. As I want to route emails which contains Airtel in Subject to a above Prepaid queue
EmailSubjectAsw = “Airtel”
Step 2:
Created Case Trigger (beforeInsert) and used this code snippet below:
trigger PrepaidEmailSubjectAsw on Case (before insert) { public static void setCaseType(List<Case> records) { String searchWords; List<String> strings; for(Case c : records) { searchWords = Label.EmailSubjectAsw; strings = searchWords.split(','); if (isStringInTarget(strings, c.Subject)) { continue; } } // end for loop } public static Boolean isStringInTarget(List<String> strings, String target) { String strRegEx = '(?i)\\b('; // case insensitive and exact match only for (String s : strings) { strRegEx = strRegEx + s + '|'; // build up a list of strings using | separator } strRegEx = strRegEx.removeEnd('|'); // get rid of the last OR strRegEx = strRegEx + ')\\b'; Matcher matcher=Pattern.compile(strRegEx).matcher(target); Boolean result= matcher.find(); return result; ID queueId = [SELECT Queue.Id FROM queuesobject WHERE queue.name='Prepaid']; Case.OwnerId = queueId; } }
Getting Error as
Line 26 Illegal assignment from List<QueueSobject> to Id Line 27 A value cannot be stored to OwnerId in type Case Line 26 Unreachable statement
Can some one provide resolution above and fix the Trigger code
Thanks In Advance,your help is appreciated
Fiona
In line 26, your querry may be returning multiple value i.e., list of values. so it has to be strore in list only.
try like below :-
In line 27, you are trying to pass the id of queue to ownerid field. you
If it solve the error, kindly mark it as the best answer.
Thanks,
Priya Ranjan
All Answers
In line 26, your querry may be returning multiple value i.e., list of values. so it has to be strore in list only.
try like below :-
In line 27, you are trying to pass the id of queue to ownerid field. you
If it solve the error, kindly mark it as the best answer.
Thanks,
Priya Ranjan
KFC Survey