You need to sign in to do that
Don't have an account?
Query Not Working...
I have a 'my account' type of page where users can create a profile if they haven't made one already and then if they have created a profile (custom object of mine Member__c) they have the option to update their profile or delete it.
Currently I have a query (updateP) that will select the logged in user and compare if their first name (which will always be unique in my case) has already been created for a username (Member__c.Name) for a profile and if so it displays a link to update their profile. The trouble I'm having is my other query (editP). I only want the create profile link to be available if the first name has not been used to create a profile username.
I have tried using the != for not equal to for the editP query which is exactly what I'm trying to do but I keep getting a compile error: unexpected token: 'Userinfo.getFirstName' which doesn't make sense to me because the other query displays the right info perfectly on my page...
Does anyone has some ideas as to what I might be doing wrong here? Thank you!!
public class myaccount { public myaccount() { } public myaccount(ApexPages.StandardController controller) { } public String ObjectType { get; set; } Member__c[] updateP; Member__c[] editP; public void initList() { query(); } Public PageReference query() { editP = [SELECT Name FROM Member__c WHERE name != Userinfo.getFirstName()] ; updateP = [SELECT Name FROM Member__c WHERE name=:Userinfo.getFirstName()] ; return null; } public Member__c[] getMember() { return updateP; } public Member__c[] getEdit() { return editP; } }
This works great! Thank you.
Apparently the result of my query wasn't quite what I was thinking I'd get so I'll have to go back and think about it again, but now I know to make sure to add in that colon.
Thanks!
All Answers
You're missing the ':' in the SOQL query - it should be
This works great! Thank you.
Apparently the result of my query wasn't quite what I was thinking I'd get so I'll have to go back and think about it again, but now I know to make sure to add in that colon.
Thanks!