Salesforce Certified Application Architect

Sunday 29 December 2013

Apex class Sample ..


public class myPageController {
private Account acc = new Account();
private List<Account> accs;
public Account getAccount()
{
return acc;
}
public void setAccount(Account a)
{
acc = a;
}
public List<Account> getAccounts()
{
return accs;
}
public PageReference ViewAccounts()
{
if (acc.Type == null)
{
//view a message because validation has failed.
ApexPages.addmessage(newApexPages.message(ApexPages.severity.INFO,'Validation Failed: Select an item fron the dropdown list.'));
return null;
}
string AccountType = acc.Type;
accs = [Select id, name, type from Account where type= :AccountType limit 20];
if (accs == null || accs.size() == 0)
{
ApexPages.addmessage(newApexPages.message(ApexPages.severity.INFO,'No data found to be shown.'));
}
return null;
}
}

No comments:

Post a Comment

Salesforce Certified Application Architect & Certified Data Architecture and Management Designer Exam

How to pass Salesforce Certified Data Architecture and Management Designer Exam This exam was 1st architect exam for me. Its not that muc...