You need to sign in to do that
Don't have an account?
Diane Roberts 3
select from where structure
I'm sure that this is something very simple that I'm missing in my SOQL structure. My current code is:
public class NewActionListController {
public List<ACT_Action__c> getnewActions() {
List<ACT_Action__c> results = Database.query(
'SELECT ID, Name FROM ACT_Action__c'
'WHERE username=:UserInfo.getUserName()');
return results;
}
}
I am getting an error that says the following:
Extra ')', at 'WHERE username=:UserInfo.getUserName()'
Can someone help? Thanks!
public class NewActionListController {
public List<ACT_Action__c> getnewActions() {
List<ACT_Action__c> results = Database.query(
'SELECT ID, Name FROM ACT_Action__c'
'WHERE username=:UserInfo.getUserName()');
return results;
}
}
I am getting an error that says the following:
Extra ')', at 'WHERE username=:UserInfo.getUserName()'
Can someone help? Thanks!
public List<ACT_Action__c> getnewActions() {
String currentUserName = UserInfo.getUserName();
List<ACT_Action__c> results = Database.query('SELECT ID, Name FROM ACT_Action__c WHERE username=:currentUserName');
return results;
}
}
Please mark it best if it helps you. Thanks.
List<ACT_Action__c> results = Database.query('SELECT ID, Name FROM ACT_Action__c WHERE username='+UserInfo.getUserName());
return results;
}
}
Some modification is needed as i shown below in code. check it out. It helpfull for you.
public class NewActionListController {
public List<ACT_Action__c> getnewActions() {
List<ACT_Action__c> results = Database.query('SELECT ID, Name FROM ACT_Action__c WHERE username = UserInfo.getUserName()');
return results;
}
}
Please mark it best if it helps you.
Thanks.