You need to sign in to do that
Don't have an account?

Search based on keyword list
Hi,
In below code I am hard coding RW: and FW: in the loop to compare and replace please suggest me how to user keywords.
Thanks
GMASJ
In below code I am hard coding RW: and FW: in the loop to compare and replace please suggest me how to user keywords.
public static void processUpdate(list<Case> cseLst) { String FWSubject; String RWSubject; String CaseSubject; list<Case> caseLst = new list<Case>(); for (Case c : cseLst) { if(c.subject <> null){ // Remove FW and RW from case subject to get exact string if(c.subject.Contains('FW:')){ FWSubject = c.subject.replaceAll('FW:',''); System.debug('FQ Trim String :' + FWSubject); CaseSubject = FWSubject; } else if(c.subject.Contains('RW:')){ RWSubject = c.subject.replaceAll('RW:',''); System.debug('RW Trim String :' + RWSubject); CaseSubject = RWSubject; } }
Thanks
GMASJ
You can pass set of keyWords in the method which you want to remove from subject.
Calling : Update Code:
If above code will solve your problem then mark this as best answer. Let me know if there any further help required on the same.
Thanks
Dheeraj Kumar
I tried using your code in below case list I am passing 4 subject values but only 2 are getting printed do you know what is the issue in the code.
Thanks
GMASJ
You can use below code which is storing the keyword as key in map and all the subject which are against that key will be stored as list in map.
Hit Kudos if this solve you problem and if this is what you are looking for then please mark it as a solution for other benefits.
Thanks
Dheeraj Kumar
Thanks
GMASJ
example:
List<Case> caseList = new List<Case>{
new Case(Subject = 'FW:Test Subject 1'),
new Case(Subject = 'RW:Test Subject 2'),
new Case(Subject = 'FW:Sudhir'),
new Case(Subject = 'FW: RW:Samarth')
Output 1: MAP{FW:=(Test Subject 1, Sudhir, Samarth), RW:=(Test Subject 2)} ???
or
Output 2: MAP{FW:=(Test Subject 1, Sudhir), RW:=(Test Subject 2, Samarth)} ???