You need to sign in to do that
Don't have an account?
Gtennent
Can put field value names in a long/rich text field and have them display in Visualforce?
Here's what I'm trying to do. I work for a small nonprofit and I want to create a button that auto-generates a pdf thank you message for staff to print out and mail. Easy enough. I also want staff to be able to update and edit the text of that thank you, without having to learn to code, using pre-defined code pieces in their document. For instance, I want them to be able to write "Thank you for your {!Opportunity.Amount} gift..." and have it show up as "Thank you for your $50 gift..."
Here's my process so far: I put a long text/field on the campaign object where staff person can paste the letter text. Then in Visualforce, I call up this text field and display it. So far so good, kinda.
My issue is that in the text of the Visualforce page it still says "Thank you for your {!Opportunity.Amount} gift...". If I use <apex:outputField ... /> instead it does the samething. It isn't displaying the information from the opportunity. If I put {!Opportunity.Amount} directly in my visualforce page it works just fine.
Here's the code for that section. Changing the escape doesn't help.
Two questions:
Here's my process so far: I put a long text/field on the campaign object where staff person can paste the letter text. Then in Visualforce, I call up this text field and display it. So far so good, kinda.
My issue is that in the text of the Visualforce page it still says "Thank you for your {!Opportunity.Amount} gift...". If I use <apex:outputField ... /> instead it does the samething. It isn't displaying the information from the opportunity. If I put {!Opportunity.Amount} directly in my visualforce page it works just fine.
Here's the code for that section. Changing the escape doesn't help.
<apex:outputText escape="false" value="{!Opportunity.Campaign.Ack_Letter_Text__c}"/>
Two questions:
- How can I put field values or apex code into a text field, and have it display properly when called in a Visualforce page?
- If the answer to 1 is no, then can you suggest a workaround that would make it easy for non-dev staff to update or create new letter copy?
you can use below tag to display richtext area in visualforce page.
For more you can refer to below link:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_display_field_values.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
What I need to do is get field values written into the text field to display in visualforce.
For example. I have a text field with the following text saved in it:
"Thank you for your {!Opportunity.Amount} gift..."
When I display the text field in visualforce I see the following:
"Thank you for your {!Opportunity.Amount} gift..."
What I want to see is this:
"Thank you for your $50 gift..."
How to I get it to say $50 not {!Opportunity.Amount}?
"Thank you for your ${!Opportunity.Amount} gift..."