You need to sign in to do that
Don't have an account?

Invalid type: DataloadTest_c
what's wrong n this code???
ERROR ::: Invalid type: DataloadTest_c
public with sharing class DataLoadTestingClass{
public String phoneVal {get; set;}
public String countryVal {get; set;}
public String cityVal {get; set;}
public String nameVal {get; set;}
public PageReference doInsert(){
DataloadTest_c objdlt = new DataloadTest_c();
objdlt.name = nameVal;
objdlt.city_c = cityVal;
objdlt.country_c = countryVal;
objdlt.phone_c = phoneVal;
insert objdlt;
pagereference ref = new pagereference('/apex/insertdlttest');
ref.setredirect(true);
return ref;
}
}
ERROR ::: Invalid type: DataloadTest_c
public with sharing class DataLoadTestingClass{
public String phoneVal {get; set;}
public String countryVal {get; set;}
public String cityVal {get; set;}
public String nameVal {get; set;}
public PageReference doInsert(){
DataloadTest_c objdlt = new DataloadTest_c();
objdlt.name = nameVal;
objdlt.city_c = cityVal;
objdlt.country_c = countryVal;
objdlt.phone_c = phoneVal;
insert objdlt;
pagereference ref = new pagereference('/apex/insertdlttest');
ref.setredirect(true);
return ref;
}
}
After looking your code it seems like you are trying to create the object "objdlt" of type custom object(DataloadTest_c ).
As per the salesforce's standard custom object should have postfix as "__c". But in your code its "_c".
So try your code after replacing "DataloadTest_c" with "DataloadTest__c".
Also Mark it best if it helps you :)
All Answers
public with sharing class DataLoadTestingClass{
public String phoneVal {get; set;}
public String countryVal {get; set;}
public String cityVal {get; set;}
public String nameVal {get; set;}
public PageReference doInsert(){
DataloadTest__c objdlt = new DataloadTest__c();
objdlt.name = nameVal;
objdlt.city__c = cityVal;
objdlt.country__c = countryVal;
objdlt.phone__c = phoneVal;
insert objdlt;
pagereference ref = new pagereference('/apex/insertdlttest');
ref.setredirect(true);
return ref;
}
}
Thanks
Mark it Best answer if it helps you
and let me inform if any issue with it
After looking your code it seems like you are trying to create the object "objdlt" of type custom object(DataloadTest_c ).
As per the salesforce's standard custom object should have postfix as "__c". But in your code its "_c".
So try your code after replacing "DataloadTest_c" with "DataloadTest__c".
Also Mark it best if it helps you :)
in your case i find you use single underscore
(_c)let me inform if it helps you :)
ERROR ::::: Invalid field city__c for SObject DataloadTest__c at line 10 column 9
plz...
my object name is DataloadTesting
DataloadTest__c is not object field