+ Start a Discussion
Admin DEV 13Admin DEV 13 

Lightning Component queries records of a custom object but get empty array even though the records do exist

Hi,
I got a lightning component in a managed package and after install the package to the test org, I added the lightning component to an Account record page. In this lightning component, it loads the records of a custom object in the same package. The records are created for that cusom object after the package installed. Then when I went to the Account record page, the lightning component failed to get the records and the return value was an empty array. But when I queried through ExecuteAnonymous, I was able to see the records. The wired thing is after I did the query through ExecuteAnonymous, I went back to the Account record page and refreshed the page. It was able to load the records of the custom object this time. I tried this in two different testing org and got the same issue. Not sure why before I quried through ExecuteAnonymous, the lightning component did not work. Could anyone help me with this?
Thanks.