• James Griffin
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
This is probably best illustrated with an example. Consider the following controller and VF page:
 
public with sharing class TestContactExtension {
    ....
    public String getTheOutputText() {
        return 'Hey {!Contact.LastName}';
    }
}

<apex:page standardController="Contact" extensions="TestContactExtension">
    <apex:outputText value="{!theOutputText}" /><br />
    <apex:outputText value="Hey {!Contact.LastName}" />
</apex:page>

Viewing this and passing in a contact ID gives me this output:
 
Hey {!Contact.LastName}
Hey Griffin

How can I have the first output (which has come from a function) rendered in the same way as the second?

Thanks, 
Griff
We are trying to deploy an un-managed package from one Dev org to another. The source has Person account enabled and target does not have Person account. We are not using any feature provided by Person account or standard Account. All the objects, pages, controllers in this package are custom developed. What is the best way to deploy this package in target organization?
  • April 13, 2016
  • Like
  • 0
This is probably best illustrated with an example. Consider the following controller and VF page:
 
public with sharing class TestContactExtension {
    ....
    public String getTheOutputText() {
        return 'Hey {!Contact.LastName}';
    }
}

<apex:page standardController="Contact" extensions="TestContactExtension">
    <apex:outputText value="{!theOutputText}" /><br />
    <apex:outputText value="Hey {!Contact.LastName}" />
</apex:page>

Viewing this and passing in a contact ID gives me this output:
 
Hey {!Contact.LastName}
Hey Griffin

How can I have the first output (which has come from a function) rendered in the same way as the second?

Thanks, 
Griff

Is there a way to render the merge fields in a string in Apex. As an example, I want to use email templates for a task. I've
written a VF page to override new task creation. It has a function that retrieves the body of the template but when its displayed
in the inputField it show the merge field syntax; i.e. Dear {!Contact.FirstName}.

 

public PageReference changeTemplate() {
EmailTemplate template = [Select TemplateType, Subject,
Name, Id, HtmlValue, Body, Description From EmailTemplate where id =:ApexPages.currentPage().getParameters().get('templateId')];

msg.Subject__c = template.Subject;
msg.Description__c = template.Body; //includes {!merge fields} as literal
}
return null ;
}

 

 I'm not sending an email as part of this process, so I need some way to render the merge fields in the string. What complicates this is that while the whoId can only be a Lead or Contact, the whatId on the task can any object. So a simple find and replace on the string gets very complex. Any suggestions?