There is issue in saving lightning components. Lightning components which has controller(which is referring User's fields).

Error message are stating like - There is no such column "Email" on User entity; where as the running user is System administrator.

Let us know, if someone found root cause, or work around for the same.

Update: Added sample code to reproduce the same

Sample component: SampleComponent.cmp

<aura:component controller="SampleClass">
    Hello World


public class SampleClass {

    public SampleClass(){
        User u = [select id, email, mobilephone from User where id=: UserInfo.getUserId()];
        System.debug('Email: ' + u.email);


Error message

Failed to save SampleComponent.cmp: Invalid definition for null:SampleClass: select id, email, mobilephone from User where ^ ERROR at Row:1:Column:12 No such column 'email' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.: Source


I also experienced this same issue in one my of custom lightning component. Where it was throwing the error message - There is no such column "ContactId" on User entity;

After struggling the whole day I got a solution for this.

It is just to recompile APEX Classes.

Steps to fix it:

  1. Login to Salesforce org
  2. Go to setup.
  3. Enter "Apex Classes" in the quick search. And then click "Apex Classes".
  4. You will see "Compile all classes" link there, just go and press it.
  5. Once it completes, go to the component and make the changes and save it. Now it should not show any error.
| improve this answer | |
  • strangely, this worked. Not sure why this is required. But yes this worked, thanks! – Ysr Shk May 8 '19 at 10:47

You need to recompile classes then it will work. When ever it doesn't save I compile all classes and i was able to save it. I suspect it might be due to summer 19 release patches.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.