Newer Version Available

This content describes an older version of this product. View Latest

PostTemplate

Represents the metadata associated with an approval post template for Approvals in Chatter. With approval post templates, you can customize the information included in approval request posts that appear in Chatter feeds. This type extends the Metadata metadata type and inherits its fullName field.

  • You can only create an approval post template for an object that is both enabled for approvals and supported for Chatter feed tracking. You can't associate a post template to an approval process unless feed tracking for the object has been turned on.
  • Deleting a custom field removes it from any approval post template that references it. Existing posts aren't affected. Undeleting the custom field restores it to the available fields list, but doesn't restore it to any approval post templates that previously contained it.
  • Deleting (or undeleting) a custom object also deletes (or undeletes) its associated approval post templates and any of its approval request posts that are already in Chatter feeds.
  • If you rename a custom object, approval post templates associated with it update accordingly.
  • You can create custom approval post templates for one or more approval processes, but you can only associate custom post templates with approval processes after enabling Approvals in Chatter.

Note

File Suffix and Directory Location

PostTemplate components have the suffix .postTemplate and are stored in the postTemplates folder.

Version

PostTemplate components are available in API version 29.0 and later.

Fields

Field Name Field Type Description
default boolean Required. Specifies whether this is the default post template for the given object.

When set to true, this post template is used by approval processes that are associated with the same object and don’t specify a post template.

When an object has no default post template, each of its approval processes uses the system default post template, unless the approval process specifies its own post template.

description string Optional description of the post template.
fields string[] Required. An array of up to four fields to include in approval request posts.

If you make your approval object a detail object in a master-detail relationship, the Owner field isn’t available for approval page layouts or approval post templates.

label string Required. Name of the post template. This non-unique label is different from the unique name of the post template.

Declarative Metadata Sample Definition

The following is an example of a PostTemplate component:

1<PostTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
2    <default>false</default>
3    <fields>NumberOfEmployees</fields>
4    <fields>NumberofLocations__c</fields>
5    <fields>PartnerAccount</fields>
6    <fields>LeadCustomFieldNumber__c</fields>
7    <label>My Lead Post Template</label>
8</PostTemplate>
The following is an example package manifest that references the previous PostTemplate component.
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>Lead.leadtemplate</members>
5        <name>PostTemplate</name>
6    </types>
7    <version>29.0</version>
8</Package>