I would like to hide the standard "New" button in our Lightning Community for our standard Contract object - as we want to enforce external users to use a custom list view button that redirects users to a Visualforce form where they create their contract.

While I know that restricting the Create permission for the object would remove the New button, this is not an option as I still need them to have create permissions.

As for overriding the Standard "New" button, this is across all users... which is not feasible.

Solution seems like I need to hide the button somehow through overriding the CSS of the theme... but not too sure what code is required for that - or even how to reference the New button in the code.

1 Answer 1

  1. Disable Create Permission from Profile, this will remove that New button
  2. Change Visualforce Page Controller to 'Without Sharing' mode, this will allow users to create records even if they do not have the permission at profile level
  • Thanks for your response... Question though. To change the VF Controller to Without Sharing, wouldn't that mean it would be changed across all records? Would it also mean I need to use a custom controller instead? Sharing for Contracts is crucial so having sharing rules ignored is not feasible. Nov 18, 2020 at 18:54
  • As you are only creating one record using that page, you will have to carefully write SOQL queries in that controller to fetch only relevant data. How many SELECT SOQL queries are there BTW? Nov 19, 2020 at 15:09

You must log in to answer this question.

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