You need to sign in to do that
Don't have an account?
Jan Revet
Not of type Custom Settings
I have a custom object namend tpdDatabase. I have an Apex class with the method below to get an instance of this object (by databasename).
The line "tpdDatabase__c tpDatabase = tpdDatabase__c.getValues(databaseName);" produces this error:
Not of type Custom Settings
I don't quite understand what goed wrong here. Could anyone point me in the right direction? Many thanks in advance!
public tpdDatabase__c getByDatabaseName(String databaseName) {
tpdDatabase__c tpDatabase = tpdDatabase__c.getValues(databaseName);
if (tpDatabase == null) {
return null;
}
return tpDatabase;
}
The line "tpdDatabase__c tpDatabase = tpdDatabase__c.getValues(databaseName);" produces this error:
Not of type Custom Settings
I don't quite understand what goed wrong here. Could anyone point me in the right direction? Many thanks in advance!
public tpdDatabase__c getByDatabaseName(String databaseName) {
tpdDatabase__c tpDatabase = tpdDatabase__c.getValues(databaseName);
if (tpDatabase == null) {
return null;
}
return tpDatabase;
}
getValues cannot be used for custom objects. Try to get the correct record with SOQL like this.
SELECT Id, Name FROM tpdDatabase__c WHERE Name = databaseName
Regards,
mirki
getValues will not work with custom objects. It will work with Custom settings only..
To fetch record from custom object you need to use SOQL.
Select Id from tpdDatabase__c WHERE Name =: databaseName
Regards,
Nimit