Friday, 25 May 2012

Summer '12 release component layout attribute

*Special thanks to Abhinav Gupta on this one, without his blog post on his Summer'12 release favourites, this problem would have taken a lot longer to diagnose*

In the upcoming Summer '12 Salesforce release, one of the new features is a layout attribute for Apex component tags. This new layout feature allows you to wrap your components in a div or span tag. The full definition can be found in the release notes under "Visualforce Enhancements". It states that the default value for the new attribute is "inline" (span tag), so any existing component where this attribute does not exist should be unaffected, as is the Salesforce release way.

However, I have found in some cases that this new attribute has had an adverse affect on the appearance of Visualforce pages and email templates that leverage components.

For example, if you have an email template that that has a text attachment defined in Visualforce, and that definition has components included, span tags will now appear as part of the attachment. Take this simple email template and component definition.

Visualforce Email Template:
<messaging:emailTemplate subject="Sample Email With Text Attachment" 
                         recipientType="Contact" >

<messaging:plainTextEmailBody >
Wow look at this attachment, It's nearly as amazing as hoverboards!
</messaging:plainTextEmailBody>

<messaging:attachment renderAs="text/plain" filename="test.txt">
Hi {!recipient.Name}, Here is your awesome text!
<c:TextComponent />
</messaging:attachment>

</messaging:emailTemplate>


Visualforce Compnent Defintion:
<apex:component access="global">
Text from a component, YES! YES! YES!
</apex:component>

If an email message using this template is sent out this is how it appears in the recipient inbox if the Salesforce Org uses the Summer '12 release:



Here is the text attachment. As you can see it contains span tags, which is not what was intended. The same template would not have produced these tags in previous releases.



The way to resolve this is simple, just add the new layout attribute to the apex component definition, with a value of "none".
<apex:component access="global" layout="none">
Text from a component, YES! YES! YES!
</apex:component>

Now when an email using this template is sent, the email attachment looks like we want:


Summer '12 is currently in sandbox orgs, but will be promoted to all orgs over the next few weeks. My advice would be to identify the pages and templates where components are used before the release, making sure they still behave as intended. If they don't, add the layout attribute with a value of "none" as above.

4 comments:

  1. AbstractWe perform a suite of smoothed particle hydrodynamics simulations to investigate in detail the results of a Yeezy Boost 350 giant impact on the young Uranus. We Coach Outlet Store study the internal structure, rotation rate, and atmospheric retention of the post impact planet, as well as Yeezy Discount the composition of material ejected into orbit. Most of the material from the impactor's rocky core falls in to the core of the target.

    Besides, there is research going on to use non chemical biological means to control Ray Ban Outlet locusts, according to FAO. "The current focus is primarily on pathogens and insect growth regulators. Thus far control by natural predators and parasites is limited since locusts can quickly migrate away from most natural enemies.

    Unlike folinic acid, the effectiveness of folic acid supplementation Coach Outlet was dependent on the E. Coli New Jordan Shoes 2020 gene, abgT, suggesting a bacterial route with PABA glu uptake by E. Coli as a first step. When it comes to talking animals, we used to watching the mouths move and sometimes, even the area around the eyes. In Mowgli, the animals faces are unnervingly expressive, which takes a while getting used to. Baloo, in particular, is given several small ticks he seems to have a Coach Handbags Clearance perpetual cold, and has Ray Ban Glasses the face of a bare knuckle boxer that add a whole new dimension to the character, which Serkis plays as a cross between Mr Miyagi from Karate Kid and Burgess Meredith from Rocky..

    ReplyDelete
  2. WARNINGS: Rituximab may rarely cause serious (sometimes fatal) side effects including severe breathing problems or heart problems (such as heart attack, irregular heartbeat). If these serious side effects occur, they usually happen during the first treatment with rituximab. Your doctor will carefully watch you during treatment and may stop or slow down your treatment if you have any signs of a reaction.

    Convenience stores Best Yeezys carry snacks and beverages, cigarettes Nike Air Force 1 Cheap Outlet and more. Some offer lottery services and provide products such as stamps, money orders and cashier's checks. A quick trip to local convenience stores will provide you with a groceries, Coach Outlet Online household goods and sundries without the hassle of a trip Cheap Michael Kors Handbags to the grocery store. Coach Outlet Clearance Sale

    THE INFORMATION, SOFTWARE, PRODUCTS, AND SERVICES INCLUDED IN OR AVAILABLE THROUGH THE REDIFF SITES/SERVICES MAY INCLUDE INACCURACIES OR Jordan Shoes For Sale TYPOGRAPHICAL MK Outlet Online ERRORS. CHANGES ARE PERIODICALLY Ray Ban Outlet MADE TO THE REDIFF SITES/SERVICES AND TO THE INFORMATION THEREIN. REDIFF AND/OR ITS RESPECTIVE SUPPLIERS MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE REDIFF SITES/SERVICES AT ANY TIME..

    ReplyDelete