5

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
</aura:component>

SampleClass

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

9
  • 1
    Can you add minimal required code to see how you are referring user object field by editing your question? Commented May 6, 2019 at 7:54
  • @sanketkumar - Added the same, you can try with version - 46
    – Ysr Shk
    Commented May 6, 2019 at 8:18
  • By any chance in your org do you have an apex class named as User?
    – Raul
    Commented May 6, 2019 at 8:27
  • 2
    Just reproduced, so strange Commented May 6, 2019 at 9:57
  • 1
    It may be related to this new Summer 19 feature releasenotes.docs.salesforce.com/en-us/summer19/release-notes/… Commented May 6, 2019 at 10:20

2 Answers 2

4

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.
1
  • strangely, this worked. Not sure why this is required. But yes this worked, thanks!
    – Ysr Shk
    Commented May 8, 2019 at 10:47
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .