Creating TrialForce Orgs in Specific Regions via Community Hub

If you use Community Hub then you are familiar of spinning up TrialForce orgs for whatever reason. My use has been spinning up TrialForce orgs for demoes and training purposes.

When I spin up TrialForce orgs they are created on the US nodes. But what if you want the TrialForce org spun up on an EU node or Asia node?

The solution is simple.

A TrialForce org will be spun up on the region specified based on the User’s locale making the request. So, if I wanted a TrialForce org on a EU node at the user level change the locale of the user to a country in Europe. Then create/request a TrialForce org from Community Hub.

Global Merge Field Type for Communities

I had a task to create an email template that was for using with communities. However, when creating a email template and using merge fields there are currently none available in the UI for communities.

The solution?

Well, it may not be available merge field in the UI there is a $Network merge field type that can be used and embedded into an email template. It  has two values that can be used:


This is all I needed for my task though I wish there were more available fields that could be used.

To read more click here:

Attachment To Object in Apex

In an earlier post, Generating an XML file in Apex, we created an XML document Xmlstreamwriter class. This post we will take the XML and attach it to an object. The code to do so is pretty straight forward:

1  Attachment attachmentProductInfo = new Attachment(); 
3  attachmentProductInfo.Name = 'PRODUCT_INFO.xml';
4  attachmentProductInfo.Body = Blob.valueOf(xmlFinalProductList); 
5  attachmentProductInfo.ContentType = 'application/xml';
6  attachmentProductInfo.ParentID='OBJECT_ID';
8  try{
9   insert attachmentProductInfo; 
10   }catch (DmlException e) {
11  System.debug('The following exception has occurred: ' + e.getMessage());
12   return e.getMessage();
13  }

Generating an XML File in Apex

I recently had the task to create some XML files based on object data and create an attachment. I’ve created XML files before in say Ruby and PHP but not in Apex. This was new to me and in the end was an easier task than I thought it would be.

First let’s create an objective. We want to create an XML file that has the following format:

1  <?XML encoding="utf-8" version="1.0" ?>
2  <catalog>
3   <product id="bk101">
4      <author>Mix Master Mike</author>
5      <title>XML In Apex</title>
6      <genre>Salesforce</genre>
7      <price>1444.95</price>
8      <publish_date>20016-12-10</publish_date>
9      <description>An in-depth look at creating applications with XML.</description>
10   </product>
11 </catalog>

This seems simple enough.

Field History Related List Missing in Lightning

Field History Tracking is a very useful tool to use on an object. This is especially great if you have many users updating the same record and you want/need to know who, when they made they made, what changes they made. The result of enabling Field History Tracking is a related list on the object that shows this information.

But only in the Salesforce Classic.