You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Error in Visualforce when rendering
Hello, I added a Visualforce to campaign page. In campaign I have the field "PDF_Vorlage__c". If the value of this field is Vorlage 1 I want to display a text in the visualforce but I get the error:
Error: Attribute value in <apex:inputField> must contain only a formula expression that resolves to a single controller variable or method in Campaign_PDF at line 24 column 93
How can I solve it. My code:
<apex:page standardController="Campaign" renderAs="pdf">
<apex:repeat value="{!Campaign.CampaignMembers}" var="cMem">
<div style="page-break-after:always;">
<h1>Welcome to APP!</h1>
<p>Thank you, <b><apex:outputText value=" {!cMem.Name}"/></b>, for working with APP.</p>
<p>Your campaign details are:</p>
<table>
<tr><th>Account Name</th>
<td><apex:outputText value="{!Campaign.Name}"/></td>
</tr>
<tr><th>Account Rep</th>
<td><apex:outputText value="{!Campaign.Owner.Name}"/></td>
</tr>
<tr><th>Customer Since</th>
<td><apex:outputText value="{0,date,long}">
<apex:param value="{!Campaign.CreatedDate}"/>
</apex:outputText></td>
</tr>
</table>
<apex:pageBlock>
<apex:pageBlockSection rendered="true">
<apex:inputField value="This is the text i want to display" rendered="{!IF(!Campaign.PDF_Vorlage__c ='Vorlage 1' )}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</div>
</apex:repeat>
</apex:page>
Error: Attribute value in <apex:inputField> must contain only a formula expression that resolves to a single controller variable or method in Campaign_PDF at line 24 column 93
How can I solve it. My code:
<apex:page standardController="Campaign" renderAs="pdf">
<apex:repeat value="{!Campaign.CampaignMembers}" var="cMem">
<div style="page-break-after:always;">
<h1>Welcome to APP!</h1>
<p>Thank you, <b><apex:outputText value=" {!cMem.Name}"/></b>, for working with APP.</p>
<p>Your campaign details are:</p>
<table>
<tr><th>Account Name</th>
<td><apex:outputText value="{!Campaign.Name}"/></td>
</tr>
<tr><th>Account Rep</th>
<td><apex:outputText value="{!Campaign.Owner.Name}"/></td>
</tr>
<tr><th>Customer Since</th>
<td><apex:outputText value="{0,date,long}">
<apex:param value="{!Campaign.CreatedDate}"/>
</apex:outputText></td>
</tr>
</table>
<apex:pageBlock>
<apex:pageBlockSection rendered="true">
<apex:inputField value="This is the text i want to display" rendered="{!IF(!Campaign.PDF_Vorlage__c ='Vorlage 1' )}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</div>
</apex:repeat>
</apex:page>
Looks like an issue with the value you are passing. Try something like See related:https://help.salesforce.com/s/articleView?id=000324662&type=1
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you