You need to sign in to do that
Don't have an account?
Erik Laramee
Expecting right square bracket error
Hi Folks, I am trying to modify a class to include and additional profile (profile name is Procurement). This is the snippet I am attempting to modify.
profiles = [select Id from Profile where Id = :Userinfo.getProfileId() and Name = 'Engineering- Apps Engineer'];
return !profiles.isEmpty();
I append ,'Procurement' to the line as such:
profiles = [select Id from Profile where Id = :Userinfo.getProfileId() and Name = 'Engineering- Apps Engineer','Procurement'];
return !profiles.isEmpty();
But I get the error: Error: Compile Error: expecting right square bracket, found ',' at line 72 column 119. Can someone help me out with what I'm missing here? Thanks!
profiles = [select Id from Profile where Id = :Userinfo.getProfileId() and Name = 'Engineering- Apps Engineer'];
return !profiles.isEmpty();
I append ,'Procurement' to the line as such:
profiles = [select Id from Profile where Id = :Userinfo.getProfileId() and Name = 'Engineering- Apps Engineer','Procurement'];
return !profiles.isEmpty();
But I get the error: Error: Compile Error: expecting right square bracket, found ',' at line 72 column 119. Can someone help me out with what I'm missing here? Thanks!
All Answers
profiles = [select Id from Profile where Id = :Userinfo.getProfileId() and (Name= 'Engineering- Apps Engineer' OR NAME ='Procurement')];
We can use both IN and OR operators but using the IN operator is more appropriate than OR operator.
Regards,
Mahesh
you cannot provide multiple values in name