function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DkaniaDkania 

Private Attribute for Component on Lightning Page

We are trying to set attributes used only internally within a component to Private. On save we are recieving the error message below. I don't see this limitatation documented anywhere and doesn't make any sense. Can someone explain why this is a limitation if the Lightning Page isn't setting any of the Private Attributes. 

Failed to save undefined: You can't set access to 'private' on attributes 'fileName' because this component is referenced by Lightning Page: 'Opportunity Record Page': Source 
Alba RivasAlba Rivas
Hi Dkania,

I would try to remove the component from the opportunity record home page in App Builder, then edit the component (set the field as private) and then add the component again.

Let me know if that helps.

Regards
DkaniaDkania
Alba,

That allows us to add the component to the page but the component does not work properly, like the component doesn't have access to set the attributes.
Alba RivasAlba Rivas
The component doesn't have access to set the attributes --> you set the attributes as private, right? Then, it shouldn't give you access according to this: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/access_attr.htm
DkaniaDkania
The component should have access to set its own attributes:

Private : Available within the component, app, interface, event, or method and can’t be referenced outside the resource.