a lot of you might find my question really basic but I am beginner. I am writing a visualforce page and here is my code.
public class CustomControllerExtension1 {
public Account accountOfInterest{get;set;}
public contact contactOfInterest{get;set;}
public CustomControllerExtension1(ApexPages.StandardController controller) {
accountOfInterest = (account)(controller.getRecord());
contactOfInterest = [select name, id from contact where id='00341000003a3gV'];
}
public void SaveCustom() {
if(accountOfInterest.monthly__c<10000) {
upsert accountOfInterest;
} else {
accountOfInterest.monthly__c=10000;
accountOfInterest.message__c='Salary is more than permitted!';
}
}
}
When I am trying to save the code its asking me to query Message object. When I queried separately as in "select message_c from account" it gives me error saying an another for the query of the same object had been found and doesn't let me run it. Please help. If needed I will provide more information and screenshots. Thank you.