4

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">    

<head>
  <title>{!$Label.AF_Title}</title>
  <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')}"/>
</head>  

<body>
    <div class="slds" style="{!IF(isEdit,'','display:none')}">
...
   </div>
</body>
</html>
</apex:page>

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;
        if(String.isNotEmpty(ordonnaceId)){
            ordonnance = [Select ... from Ordonnance__c where Id =:ordonnaceId limit 1];
        }else{
            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.