You need to sign in to do that
Don't have an account?
Mythili
SOQL error on enabling namespace
Hi,
I have enabled namespace in my dev org. Namespace name - LightningMyth.
When I write the following query in any class/trigger, I get the error : : Illegal assignment from List<Account> to List<LightningMyth.Account>
List<Account> acc=[SELECT ID FROM ACCOUNT limit 1];
but the same query works fine in workbench and QueryEditor.
When I changed the query to List<LightningMyth.Account> acc=[select id from LightningMyth.Account limit 1];
I get this error - Compile Error: First SObject of the FROM statement must be a valid SObject type.
I get this issue after enabling namespace and this issue is only with Account object, the SOQL with other standard and custom objects works just fine.
Any help is appreciated!
I have enabled namespace in my dev org. Namespace name - LightningMyth.
When I write the following query in any class/trigger, I get the error : : Illegal assignment from List<Account> to List<LightningMyth.Account>
List<Account> acc=[SELECT ID FROM ACCOUNT limit 1];
but the same query works fine in workbench and QueryEditor.
When I changed the query to List<LightningMyth.Account> acc=[select id from LightningMyth.Account limit 1];
I get this error - Compile Error: First SObject of the FROM statement must be a valid SObject type.
I get this issue after enabling namespace and this issue is only with Account object, the SOQL with other standard and custom objects works just fine.
Any help is appreciated!
You don't need to provide prefix of namespace while working with query. You can just use following query:
List<Account> acc=[select id from Account limit 1]
Thanks,
Amit
I first queried the way you said but got the following error - : Illegal assignment from List<Account> to List<LightningMyth.Account>.
Whereas the query with other objects like Contact etc. works perfectly fine.
sobject[] acc=[select id from Account limit 1] - for some strange reason only this query works with Account. I face this issue only with account object. This is wierd!
This is a general schema error, sometimes which came out due to enable of namespace. For overcome we can use below line also.
Schema.Account a =[SELECT Id FROM Account WHERE name = 'contactmeforsfdc'];
Thanks.
Salesforce Learner