Skip to main content
Hello, 

I want to identify all cases that have the 'Case Origin' field set to 'email'. I then want to update these records with a new  'Case Origin' value of 'Phone'. Can you please explain how I would go about doing this? It would be helpful if you can write out the code as well. Thanks! 
2 answers
  1. Jul 11, 2017, 8:17 PM

    //1. use query to get the list of cases where origin is email

    //2. iterate on the list and update origin to phone

    list<Case> caseList=[select id from case where Origin='Email'];

    for(Case c:caseList){

    c.origin='Phone';

    }

    update caseList;

     
0/9000