You need to sign in to do that
Don't have an account?
Page message on page load
I am trying to display a msg when number of records in the list is 0.
but it is displaying on page load.
here is the code.
Public class Mycontroller {
String searchText;
List<Account> results;
List<Case> Score = new List<Case>();
String SetAcc;
List<FeedBack__c> fback ;
Public string getSearchtext(){
return searchText;
}
Public PageReference doSearch () {
results = (List<Account>) [FIND :searchtext RETURNING Account(ID, Name, Account_type__C)][0];
return null;
}
Public void setSearchText (String s) {
searchtext = s;
}
Public List<Account> getResults() {
return results;
}
Public List<Case> getScore() {
Score = [select Account.Name, casenumber, Solution_Type__C, ClosedDate, Priority from case where Account.ID = :ApexPages.currentPage().getParameters().get('aid') and status = 'Closed' limit 10];
if (Score.size() == 0 ){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'No Records Found'));
return null;
}
return Score;
}
Public List<Feedback__c> getfback() {
fback = [select Case__c, TAM__c, Account__c, Score__c from feedback__c where Account__c = :ApexPages.currentPage().getParameters().get('aid')];
return fback;
}
}
Still learning , any help is appreciated
Thank you!
Worked like a charm..perfect!
Najoop
All Answers
Take one boolean variable in controller and set it to false in declaration.
Assign it to true when you do some operation and want to display the message.
check this variable to true then add msg to Apex message.
Thanks,
Kamlesh
Thank you!
Worked like a charm..perfect!
Najoop