-3
public class casess {
    public static void invokebatch(list<cases> css){
        for(case dsv:css){
            shadow case_c sc=new shadow case_c();
            sc.caseid=dsv.Id;
            sc.casenumber=dsv.CaseNumber;
            sc.casestatus=dsv.Status;
        }      
    }  
}
2
  • 2
    Welcome to SFSE, kindly go through the tour section to get a feel of this community and how it works. Then, check out how to ask a good question article to know what details you need to include for the question to be answered quickly and avoid getting negative reputation.
    – Mahmood
    Mar 10, 2017 at 13:47
  • 1
    shadow case_c sc=new shadow case_c(); what is the api name for shadow case_c ? please use proper API Name. Mar 10, 2017 at 14:11

1 Answer 1

4

I think you're not referencing to your custom object properly. That's why you're getting an error. It should be something like this shadow_case__c. Use API name of your custom object correctly. Your code should be something like this:

 public class casess {
    public static void invokebatch(list<cases> css){
        for(case dsv:css){
            // API name of your custom object
            shadow_case__c sc=new shadow_case__c ();
            sc.caseid=dsv.Id;
            sc.casenumber=dsv.CaseNumber;
            sc.casestatus=dsv.Status;
        }      
    }  
}

If you're planning to use shadow_case__c further then as per standard practice you should use List. This will reduce your DML queries. Sample Example:

public class casess {
    public static void invokebatch (list<cases> css){
        List<shadow_case__c> showCaseList = new List<shadow_case__c> ();

        for (case dsv : css) {
            // API name of your custom object
            shadow_case__c sc = new shadow_case__c ();
            sc.caseid = dsv.Id;
            sc.casenumber = dsv.CaseNumber;
            sc.casestatus = dsv.Status;
            showCaseList.add (sc);
        }      
        // further processing of showCaseList
    }  
}
1
  • 1
    thank you rohit. ya i forget to write shadow_case_c.thank you for your answer Mar 11, 2017 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.