I've developed a visualforce page for a custom object on Lightning. When I embedded the page to the layout, it is showed in new and edit. I want that works as salesforce classic (show the visualforce only on View). I tried adding a condition on my page to display the content only when is != New but still appears a blank space due to the Height configured when was added the VF page to the layout. I hope exists another solution! Thanks!

VF Page:

<apex:page showHeader="false" standardController="Ordonnance__c" extensions="PatientAutofieldsController"
            standardStylesheets="false" sidebar="false" applyHtmlTag="false" 
            applyBodyTag="false" docType="html-5.0">

<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">    

  <apex:stylesheet value="{!URLFOR($Resource.SLDS0120, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
  <apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/jquery-1.11.3.min.js')}"/>
  <apex:includeScript value="{!URLFOR($Resource.AutoFields, 'AutoFields/js/AutoFields.js')}"/>

    <div class="slds" style="{!IF(isEdit,'','display:none')}">

Controller Class:

public class PatientAutofieldsController {

    public Ordonnance__c ordonnance {get;set;}
    public string ordonnaceId {get;set;}
    public boolean isEdit {get;Set;}

public PatientAutofieldsController(ApexPages.StandardController stdCntrl){
        isEdit = true;
        ordonnaceId = stdCntrl.getRecord().Id;
            ordonnance = [Select ... from Ordonnance__c where Id =:ordonnaceId limit 1];
            isEdit = false;
  • can you provide the code which you are using? – Nitin Jan 15 '16 at 15:59
  • I think it was impossible in classic last I checked. – Adrian Larson Jan 15 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.