• Kalyani Gade
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
Create a custom object ‘Case Solution’ with fields Case Description, Resolution.
- Create a custom field ‘Accept Solution’ as a checkbox on Case object.
- Create a custom field ‘Resolution’ as a text area on Case Object.
- Whenever a case has the status ‘Closed’ and its ‘Accept Solution’ checkbox is selected; a new Case Solution record should be created.
Create a custom object ‘Case Solution’ with fields Case Description, Resolution.
- Create a custom field ‘Accept Solution’ as a checkbox on Case object.
- Create a custom field ‘Resolution’ as a text area on Case Object.
- Whenever a case has the status ‘Closed’ and its ‘Accept Solution’ checkbox is selected; a new Case Solution record should be created.
Hello everyone,

I am trying to write a trigger that checks to see if a case is open for an account. If there is no case open then i want it to open a case with certain criteria. I have gotten the code to not throw any errors right up into the end. I was wondering if anyone can help me polish off my last 2 lines of code so that the Case will be Inserted.
trigger caseCheck on Account (After update) {
    for(Account myAccount : Trigger.new){
    List<Case> openCase =[Select id
                          From Case
                          Where (Accountid = :myAccount.Id 
                                 AND
                                 Status IN('New','Open')) ];    
        System.debug(openCase.size() + ' Open case(s) found');
 
        if(openCase.isEmpty()){
            Case c = new Case();
            c.Accountid = myAccount.Id;
            c.Type = 'ICM';
            c.Origin = 'SHIP';
            c.Division__c = 'Case Management';
            c.Status = 'New';
            c.RecordTypeId = '01236000000OJLq';
            }  
        Case.add(c);
        Insert Case;       
    }
}

I am reveiving the following errors;
Variable does not exist: c
Variable does not exist: Case
 
I want to write trigger to enable a checkbox in contact whenever its Account is modified(updated). 
I'm not able to put the condition for Account updated or not! Can you guys provide the logic?? 
 
  • April 12, 2017
  • Like
  • 1