I have created a managed package which contains a Lightning Component which uses a Custom hierarchy Settings object.

You can see here that the Settings object is packaged. enter image description here

It is referenced within the lightning component like

<aura:attribute name="settings" type="TestSettings__c"/>

within the org, the component works without a hitch. But when I attempt to deploy this package in a sandbox org, I get an error which looks like this. (The namespace has been altered) enter image description here

I am not quite sure why I am seeing this error.. and I can't find any posts of anyone else experiencing this problem.

  • Have you tried adding the namespace prefix MyNamspace__ to the attribute in the package dev org:<aura:attribute name="settings" type="MyNamspace__TestSettings__c"/>
    – Praveen
    Jul 28 '16 at 18:12
  • @Praveen : same result
    – Jason Lee
    Jul 28 '16 at 18:13
  • Can confirm the visibility of the custom setting? Is it marked Public/Protected?
    – Praveen
    Jul 28 '16 at 18:20
  • @Praveen : protected.
    – Jason Lee
    Jul 28 '16 at 18:21
  • Can you try changing to Public and test it?
    – Praveen
    Jul 28 '16 at 18:22

I thinks the issue it due to the visibility of the custom setting in the subscriber org.

Try changing the Visibility of the custom setting to Public, it would solve the issue.


Looking back on this question, it actually was ridiculous that the only way to make this work was to NOT use protected settings (why would that feature exist if it wasn't supposed to be used?).

After weeks of diagnosis by the Salesforce support team, we found out there is a bug with custom metadata types (including custom settings), not able to be referenced by lightning components directly, you would need to use a wrapper class to access it or else it would throw an exception.


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.