I have a visualforce page that represents a contract document, which I'm exporting as .doc file.

This visualforce page's controller makes a query to get some of the fields of the contract record. Then, in my VF page (with inner components) I build a huge contract text using those fields. For some reason though, the only one that actually displays correctly is StartDate, but I'm having problems with all the other fields, including some standard fields (for example, CustomerSigned) and custom fields. All of the text fields render as blank spaces, and all the number fields render as 0.00 (even if the fields have values).


  1. I've tried with apex:outputField and apex:outputText and displaying the field directly, with no luck.
  2. I've tried adding the rendered attribute checking that the variable has been assigned with the record, like rendered="{!contract != null}"
  3. I added a Sytem.debug after the query to see if all the fields are alright, and they are.
  4. I checked if the user I'm testing has the read permissions for all the fields (it does, as I'm in a sandbox using the admin user)
  5. I inspected the rendered HTML and I can see the inserted for the fields, but no value present.

This is the beginning of the first sentence of the document:

enter image description here

As you can see, the date field can be seen, but then the other fields are not rendered, just blank spaces.

This is the inspected HTML:

enter image description here

In the rendered HTML, we can see the span element for the date with the right value, and then the other two spans for the other two fields, but with no value inside.

I looked for similar issues online but I've tried anything... At first I thought that the problem was changing the content type to msword, but when removing that and visualizing the visualforce page on salesforce, the issue persists. Any help would be appreciated!

This is the code for the first sentence of the document:

                    En la ciudad de Punta del Este, el &nbsp;<apex:outputField value="{!contrato.StartDate}" />, comparece  el Sr &nbsp;<apex:outputField value="{!contrato.CustomerSigned.Name}" />, con Documento de Identidad &nbsp;<apex:outputField value="{!contrato.Documento_Tipo__c}" rendered="{!contrato.Documento_Tipo__c != null}"/> &nbsp;<apex:outputField value="{!contrato.Documento_Nro__c}" /> de Nacionalidad &nbsp;<apex:outputField value="{!contrato.Nacionalidad__c}" />, con domicilio físico en &nbsp;<apex:outputField value="{!contrato.Domicilio__c}" />, Uruguay, y domicilio  electrónico &nbsp;<apex:outputField value="{!contrato.Email__c}" />, Móvil &nbsp;<apex:outputField value="{!contrato.Telefono__c}" /> en adelante el "Reservante" y por la otra parte INMOBILIARIA Horus Group con domicilio en Edificio Stradivarius apto 1605, Punta del Este, representada en este acto por el señor Darwin Scrollini, con cédula de identidad número Ci 3672709-2/ HHO BROKER Real Estate con domicilio en Av. Roosevelt Pda.1, Biarritz esq, Tabaré, Punta del Este, representada en este acto por el señor &nbsp;<apex:outputText value="{!contrato.Contacto_Inmobiliaria__r.Name}" />, con cédula de identidad número &nbsp;<apex:outputText value="{!contrato.Cedula_Inmobiliaria__c}" /> en adelante la "Inmobiliaria".- AMBAS PARTES CONVIENEN CELEBRAR LA PRESENTE RESERVA (en adelante, la "Reserva"):

Controller code:

public with sharing class DocumentoContratoController {

public String contractId;

public Contract contrato {get;set;}
public String customerSignedName {get;set;}

public DocumentoContratoController() {}

public DocumentoContratoController(ApexPages.StandardController stdCon){
    contractId = stdCon.getId();

public void init(){
    contrato = [SELECT Id,
                FROM   Contract 
                WHERE Id = :contractId];


public Integer getCantCuotasMenos(){
    return Integer.valueOf(contrato.Cantidad_de_cuotas__c - 1);

public Boolean getIsReservaAtelier(){
    return contrato.Edificio__c == 'ATELIER' && contrato.RecordType.Name == 'Reserva';

public Boolean getIsReservaLeParc(){
    return (contrato.Edificio__c == 'Le Parc Punta del Este - Torre IV' || contrato.Edificio__c == 'Le Parc Punta del Este - Torre III') && contrato.RecordType.Name == 'Reserva';

public Boolean getIsCompromisoLeParc(){
    return (contrato.Edificio__c == 'Le Parc Punta del Este - Torre IV' || contrato.Edificio__c == 'Le Parc Punta del Este - Torre III') && contrato.RecordType.Name == 'Compromiso';

public Decimal getSuperficieRedondeada(){
    return Decimal.valueOf(contrato.Superficie_total_m2__c).round();

public String getDocumentoTipo(){
    return contrato.Documento_Tipo__c;
  • Please use edit and show the markup for the first sentence of the contract along with the relevant portions of the VF controller. Try and make your edit focused only on the minimum needed to reproduce the issue (also check FLS for the running user)
    – cropredy
    Dec 5, 2022 at 19:43
  • @cropredy I added the code for the controller, the code for the VF is already there and I specified that I already checked FLS.... Dec 5, 2022 at 19:46
  • if you create a VFP page with only <apex:outputField>s and no other markup, do they display? Is the VFP bound to the controller you posted?
    – cropredy
    Dec 5, 2022 at 20:02
  • @cropredy yes, all the components are bound to the controller as well as the VF that contains them, and if I create a new component with just outputfields, only the StartDate field is displayed and the others are blank, just like with the original components. Dec 5, 2022 at 20:28
  • try removing the components and just use a bare-bones VFP w/ the apex:outputFields. Simplify the problem down to the barest possible implementation. I'd also move the init() code inside the getter for contrato
    – cropredy
    Dec 5, 2022 at 21:26

1 Answer 1


To debug problems like this, you need to reduce the problem down to something that works, then build up, piece-by-piece until you get the observed fail behavior.

Everything in your OP and comment thread suggests strongly at a binding issue between your VF components and the controller's value for contracto

To prove this (because your controller looks fine):

  • Move your apex:outputFields out of the component and into the main Visualforce Page.
  • If they render correctly, then the issue is that your component may not be getting the same controller instance as the main VF page or, if your components are using their own component controllers, these might not be fetching the Contract correctly - perhaps because the chain of values passed by the VFP to the component to the component controller has a gap.
  • That is correct. I ended up moving all the code of the different components inside my VF page, and that worked. The components shared the same controller, because the only reason I used separate components is because they represented different use cases.. but clearly some weird behaviour with the value of the Contract was not making things easy. Thanks for the help! Dec 6, 2022 at 17:23
  • 1
    a VF component, even if it references the same controller name as the main VFP gets a different instantiation of that controller. If they need to share the main VFP controller object, you have to pass a VFP property that returns this to the components
    – cropredy
    Dec 6, 2022 at 17:26

You must log in to answer this question.

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