6

To reference the target user record, I should use {!Target_User.[FIELD]} where [FIELD] is the field name. Link


6

This is a simple "regular expression" situation. You can use the following code as a starting point: Pattern p = Pattern.compile('\\{!.+?\\}'); string templateContent = 'hello adrian , this is for {!Contact.Name} to be delivered to {!Account.ShippingAddress}'; Matcher m = p.matcher(templateContent); while(m.find()) { System.debug(m.group(0)); } Where \\...


4

This example worked for me: {!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} if('{!Opportunity.Type}' == 'New Customer' && '{!$Profile.Name}' != 'System Administrator') { alert("A quote record cannot be created for this Opportunity Type."); window.parent.location.href=window.parent.location....


4

Salesforce support told me the following: For portal users, the Receiving_User is actually pulling fields from the Contact object, not from the User object. Even the standard fields are from the Contact, not from the User.


4

The variable API is actually $Api. Note that this variable is case sensitive, and must have the $.


4

A "merge field" simply means an area (the "field") where output from a function or expression is "merged" into the final output. In other words, the source code is basically a template, and some parts can be dynamically updated via the merge field syntax. One of the earliest versions of merge fields I recall was the "mail merge," where you'd place fields ...


3

If you use a Visualforce Email Template, you can use <apex:outputText value="{!Object.Field__c}" escape="false"/> You cannot do it without using a Visualforce Email Template


3

Yes it is possible, you would need to combine the following types of functions: IF(logical_test, value_if_true, value_if_false) and replace logical_test with the expression you want evaluated; replace value_if_true with the value you want returned if the expression is true; replace value_if_false with the value you want returned if the ...


3

It is a weird issue, but it got fixed when I cloned the email template and used it in the workflow's email alert instead of the old email template. This seems to be a bug, as the new email template is an exact replica of the old one (didn't even copy paste, it was just cloned).


3

From what I remember standard emails (= non-Visualforce ones) will give you hard time when you want to use more than one dot to go "up". I'm aware of only 2 workarounds you have mentioned: a helper formula field (type = URL maybe? so it's at least a bit reusable); I've created "Case Contact's Phone" etc that way in the past craft the URL by hand using the ...


3

The &EmailAdditionalTo parameter requires a value of either A) a single email address or B) multiple email addresses separated by commas. Your requirement can be accomplished by using a SOQL Query (available to be used with Conga Composer by using a free add-on) to query Group Member email addresses. You'd then use the &QVar parameter to reference ...


3

I just created an email template and a custom text field Case.Type__c and can confirm that the custom field "hides" the standard field. Surprising. The simplest work-around is to ensure that the custom fields you want to present have significantly different names to the standard Case fields. If you can't change the name of Case.Type__c, then you can add a ...


3

Use JSENCODE Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a backslash (), before unsafe JavaScript characters, such as the apostrophe ('). {!JSENCODE(text)} and replace text with the merge field or text string that contains the unsafe JavaScript characters. var leadStreet = "{!JSENCODE(lead....


3

I think I found the issue, based on your assert I assume you are trying to get the bank__c info related to Submission__c in the unrendered string. Change 'Dear {!Bank__c}...' to 'Dear {!Submission__c.bank__c}...'


2

SFDC developer support confirms that if you do a field update in an Approval Process step action and also have a VF (not text/HTML) email alert in the same approval process step action, that VF email alert will NOT merge in the updated-from-the-Field-Update value into the VF template. This is contrary to the doc which states that field updates occur prior to ...


2

I think theGreatDanton's answer is pretty good, and will probably be useable in most cases. For some reason I can't get it to work though, so I created my own little replacer: public static String MergeText(String source, SObject obj){ String s = ''; if(source != null && obj != null){ Integer curPos = 0; Pattern ...


2

I faced this crazy issue when I copy+pasted the merge field from one environment sb to another. It got fixed when i copied the field from the 'Copy Merge Field Value' text box from the 'Available Merge Fields' in the Email template, sounds like a crazy solution, but it worked for me!


2

You forgot the dollar sign in your Site-variables, please replace your code with: <br/>tld: {!$Site.TopLevelDomain} <br/>upp: {!$Site.UrlPathPrefix} <br/>id: {!$Site.Id} <br/>ml: {!$Site.MasterLabel} <br/>name: {!$Site.Name} <br/>sd: {!$Site.Subdomain} Remember that all global variables are referenced with a dollar sign.


2

Look at the docs: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputCheckbox.htm the attribute type for value is object, you are passing boolean instead of an object value Object A merge field that references the controller class variable that is associated with this checkbox. For example, if the name of the ...


2

What I would suggest, probably the easiest and quickest way to do this, is to add all the fields that you want to display on the page, into a field set. Then you can easily reference that field set in your VF page and display each of the fields by using your pbook object instance: <apex:repeat value="{!$ObjectType.Event__c.FieldSets.yourFieldSet}" var="...


2

OK, here is the answer - it is in the SFDC Help doc here: https://help.salesforce.com/HTViewHelpDoc?id=merge_fields_email_templates.htm&language=en_US Templates with contact merge fields can be used to generate email documents for leads. Likewise, you can use lead templates to generate contact emails and documents. I suspect the reason for this is to ...


2

Use the ReceivingUser variable instead of the User variable; the ReceivingUser parameter is the user being addressed, while User is the person sending the email.


2

I resolved this issue. From the Email Template Editing page, there is an "Available Merge Fields". From that panel, people can choose whatever merge field for the Email template. Here for my usage, the correct merge field should be "Target_User". Receiving_User does not work as it is working for either Email triggered from Community or the Mass Email. ...


2

Don't use a merge field for your rerender attribute. Just use a literal value. Incorrect: reRender="{!covenanttable}" Correct: reRender="covenanttable" When you use a merge field, the markup then looks for a property by that name, which is not defined. Note the description of the rerender attribute from the documentation on <apex:actionSupport>: ...


2

You should look at the setTreatBodiesAsTemplate method. Optional. If set to true, the subject, plain text, and HTML text bodies of the email are treated as template data. Example usage: Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setPlainTextBody('Sending a test to {!Contact.FirstName}'); email.setTreatBodiesAsTemplate(...


2

There is a checkbox on every custom object definition, "Track Activities". You'll need to ensure that the box is set on VOHLI_Leads__c so that it can be the WhatId of a Task. Your merge fields, presumably, are using a relationship path that goes through the related object. That's what WhatId corresponds to in the template, so if WhatId is not populated, ...


2

There is no way to 'merge' subscribers. Every individual Contact with a unqiue Subscriber Key also had system defined attributes which can only be changed by Salesforce Service Team and requires their side action, which is quite costly. They would be able to change Subscriber Key from one value to another and retain the history, but not merge two (or more) ...


2

There are few things you are doing wrong. if you are Using Template, you dont have to manually add htmlBody,subject to the Single Email Message instance. As you are sending a message to contact, you need to use setTargetObjectId instead of whoId. You are trying to send email to All contacts which will fail because of Salesforce Limits. Your code will be ...


1

First, I'd recommend you institute the use of a Validation Rule that requires a Contact to have a First Name in order for it to be saved. That appears to be part of the source of your problem. To answer your real question, you could change your formula to look something like this: IF(Account__r.Name = Contact__r.FirstName & Contact__r.LastName ,, "...


1

From within workflow, the related contact should already be in the context of the workflow. That's why {!Contact.FirstName} should work. However, if the field isn't populated in the contact's record, workflow won't be able to enter data for it in the template. I suggest you test your template with a record you know has valid data in the {!Contact.FirstName}...


Only top voted, non community-wiki answers of a minimum length are eligible