I have a lightning component with its associated javascript controller and helper. Now I have the requirement to make the javascript controller and the helper read-only. Can anyone give me an idea to make this possible in Salesforce? Can we apply the user level security on these javascript files of the lightning component?

  • What do you mean by read-only?
    – ytiq
    Aug 18 '20 at 12:42
  • Need to make those javascript controller files as read-only OR need to apply some security so that for some user it can't be editable or not visible,
    – Sam
    Aug 18 '20 at 12:46
  • you can't really restrict access for Developers to parts of the code in one org in a straight forward way. You can separate Development into different Sandboxes/Scratch Orgs and control who deploys what.
    – ytiq
    Aug 18 '20 at 12:49
  • Please expand your question with more details, so I can provide more details on how you can reach desired behaviour
    – ytiq
    Aug 18 '20 at 12:50

Your requirements not really clear, but I'll try to answer according to the question.

You can't restrict access Edit to Components, you can either see them or not.

If you want to limit somewhat editability you can put them into Unlocked or Second-generation Package and it would allow you to return to the initial state at any moment.

Also would suggest using Version Control to track who changed what


You can also create Managed Package and it will prevent the editability of your components, but I don't know if you want to distribute your code.

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.