+ Start a Discussion
Adelchi PelizzoAdelchi Pelizzo 

Method does not exist or incorrect signature: createData()

I have this small piece of code here:
public class CreateDataFiscCode {
    public Contact createData(){
        Contact contact = new Contact
                FirstName = 'Paolo',
    			LastName = 'Polio',
        		Birthdate = date.parse('12/12/1912'),
        		Birthplace__c = 'Attimis',
        		Provincia__c = 'UD',
        		Sesso__c = 'M'
        insert contact;
        return contact;

I do not understand why when I execute anonymously just the mothod <createData()> I get the above error: Method does not exist or incorrect signature
Best Answer chosen by Adelchi Pelizzo

Am not sure how you are calling in your anonymous block, but this should work:
CreateDataFiscCode  cls = new CreateDataFiscCode (); 

Alternatively, you can declare the createData function as static to call it directly without instantiating the class variable. 

If your problem/query is resolved, please mark your post as "Solved" so that community can benefit from resolved posts.