You need to sign in to do that
Don't have an account?
Error: Compile Error: unexpected token: 'return' at line 9 column 8
public class myControllerExtension {
public myControllerExtension(ApexPages.StandardController stdController) {
//this.acct = (New_Application__c)stdController.getRecord();
User u = [select FirstName, Lastname from User where Id = :UserInfo.getUserId()];
}
public String getEmployee_ID() {
contact c = [select Employee_ID__c from contact where (FirstName = :u.FirstName AND Lastname = :u.Lastname)]
return 'hello' + c.Employee_ID__c; //here is problem
}
}
public myControllerExtension(ApexPages.StandardController stdController) {
//this.acct = (New_Application__c)stdController.getRecord();
User u = [select FirstName, Lastname from User where Id = :UserInfo.getUserId()];
}
public String getEmployee_ID() {
contact c = [select Employee_ID__c from contact where (FirstName = :u.FirstName AND Lastname = :u.Lastname)]
return 'hello' + c.Employee_ID__c; //here is problem
}
}
Please try below code. ; was missing in query
public class myControllerExtension {
public myControllerExtension(ApexPages.StandardController stdController) {
//this.acct = (New_Application__c)stdController.getRecord();
User u = [select FirstName, Lastname from User where Id = :UserInfo.getUserId()];
}
public String getEmployee_ID() {
contact c = [select Employee_ID__c from contact where (FirstName = :u.FirstName AND Lastname = :u.Lastname)] ;
return 'hello' + c.Employee_ID__c; //here is problem
}
}
Please let us know if this will help u
Please try the bleow one. Use UserInfo class to avoid one query in your constructor.
Thanks.