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
Stephanie Boggs 17Stephanie Boggs 17 

Adding Contact Roles on Visualforce page in Lightning takes me to Classic

I added the Contact Roles related list on a Visualforce page with <apex:relatedList list="OpportunityContactRoles"/>. I have the following in the VF page to display in Lightning - lightningStylesheets="true"

When in Lightning, I click a button, get taken to the VF page. Click New on Contact Roles to add a new one, but get taken to the Classic view of adding a new contact role, not the new Lightning view. How can I make it so the user stays in Lightning the whole time?
NagendraNagendra (Salesforce Developers) 
Hi Stephaine,

As per Salesforce Docs

If a Custom Object Related List (via a lookup relationship to another Object with a corresponding Related List) appears in Classic but not Lightning, review the Field Level Security of the Object with the missing Related List.

To display the Related List in Lightning, the Custom Object's Field Level Security must be set to "Visible" for all profiles (not set as "Hidden").

So check for the field permission as well.

Custom Object Related Lists missing in Lightning Hope this helps.

Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Stephanie Boggs 17Stephanie Boggs 17
This is the standard Contact Roles related list on the Opportunity. On the Opportunity related list on the Lightning page layout there is a button named "Manage Contact Roles" which displays in Lightning style. I built a Visualforce page for users to confirm certain attributes and fields on the Opportunity prior to submitting to Legal. I added <apex:relatedList list="OpportunityContactRoles"/> to the Visualforce page styled with Lightning Sheets, and it displays a "New" button instead of the "Manage Contact Roles" button. When the New button is clicked, it takes me back to Classic to add Contact Roles.