+ Start a Discussion
jpgilbertjpgilbert 

Discrepancy between Visualforce Communication Template output and field decimal value

Hi,

I have a custom object called Style__c which has a Lookup field to Product2 table called.

When I run a SOQL command inside the controller of my Visualforce template, ReturnFormStyleInfo, the name value doesn't report.

When I choose the template which refers to the controller, the data populates the email template but you can see it is missing the Product Name:

template output, doesn't include product2 lookup Style name field

Running a SOQL query directly, you can see that the name should be available for output via the component.

direct query on Style__c records aligned to case, showing that the name field is being pulled

Here is the getStyleInfo method from the class ReturnFormStyleInfo
public string getStyleInfo()
{
        string ret = '\nStyle\t\tPrice\tQty\n';
        for(Style__c s : [SELECT Style__r.Name, Price__c,Quantity__c FROM Style__c WHERE Case__r.CaseNumber=:thecase])
        {
            ret += s.Style__r.Name + '\t$' + s.Price__c + '\t' + s.Quantity__c + '\n';
        }
        return ret;
}

Which is referenced in this component.
<apex:component access="global" controller="ReturnFormStyleInfo">
<apex:attribute name="casenum" description="This is the CaseNumber of the case." type="string" assignTo="{!thecase}" />
{!StyleInfo}
</apex:component>
Gigi.OchoaGigi.Ochoa
Have you checked profiles to make sure you can view Product object and the fields?