• Chunawala Arva
  • NEWBIE
  • 15 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello Everyone,

 I am new to salesforce.
It’s related to parent-child case relation. Basically, I want to fetch particular TEXT(Keyword) defined in the description field of the parent object and I want to fetch that particular keyword to the related case of its parent case. I have written the following trigger but I need to modify it to fulfill above requirements.
trigger CheckSecretInformation on Case (after insert,before update) 
{
 String childCaseSubject = 'Warning: Parent Case may contain secret info.';
  //Create collection of secret keywords
    Set<String> secretKeywords = new Set<String>();
      secretkeywords.add('Credit Card');
      secretkeywords.add('Social Security');
      secretkeywords.add('SSN');
      secretkeywords.add('Passport'); 
      secretkeywords.add('Body Weight');
    
    //Check if your case contain any of secret keyword
	List<Case> casesWithSecretInfo = new List<Case>();
    List<Case> caseWithUniqueKeyword = new List<Case>();
    for(Case myCase : Trigger.new)
    {
        if(myCase.Subject != childCaseSubject){
           
        for(String keyword : secretKeywords){
            if(myCase.Description != null  && myCase.description.containsIgnoreCase(keyword))
            {
             casesWithSecretInfo.add(myCase);
                
             System.debug('Case' + myCase.Id + 'include secret keyword' + casesWithSecretInfo);
             break;
            }
        }
            
        }
    }
       //If case contains secret keyword create child case 
        List<Case> casesToCreate = new List<Case>();
       	for(Case caseWithSecretInfo : casesWithSecretInfo)
        {
            
            Case childCase = new Case();
            childCase.Subject     = childCaseSubject;
            childCase.ParentId    = caseWithSecretInfo.Id;
            childCase.IsEscalated = true;
            childCase.Priority    = 'High';
            childCase.Description = 'The Sensitive Information was found: ' + secretkeywords;
            casesToCreate.add(childCase);
        }
            insert casesToCreate;  
    }

Thanks in advance.
Hi,

I don't understand why I still get an error while validating the first challenge

Account are deduplicated, names are not in uppercase, and all fields are correctly imported (Residential type was activated)

list of accounts

But still this message :

error
Any idea ? I made it on 2 different playground orgs, and still the same