Skip to main content

Call List Template

Call List Template


These text fields allow a customised call list template to be specified. Salesforce only allows 255 characters in custom settings text fields, which is normally not enough for a real-world template, so it is possible to overflow onto Call List Template 2 and 3 as necessary.

Always end the section before an overflow at a line ending. Salesforce removes all extra lines before and after a text entry, so a newline is automatically entered by the CTI between the overflow fields.


The recent call list template allows for the building of a recent call log UI that suits the organisation. It may include custom fields in the Task list, or even a custom object.

The default template (used internally) is:

FIELDS: Subject,Description,Who.FirstName,Who.LastName,CallObject,Account.Name,CreatedDate
QUERY: CallType In('Inbound','Outbound') AND CreatedDate > LAST_WEEK
ORDER: CreatedDate DESC

{{{Subject: substr 5}: nicedate %d/%m/%Y %H:%M}: ifnull {CreatedDate: nicedate %Y-%m-%dT%H:%M:%SZ}}%%{{Name: ifnull {FirstName: case $null$:, true:} {LastName: case $null$:, true:}}: case  :{CallObject}}
Subject%%{Subject: substr 0,100}
Desc%%{Description: substr 0,100}
Account%%{Name: case $null$:, true:}
Contact%%{{FirstName: case $null$:, true:} {LastName: case $null$:, true:}: case  :}

The best approach to describe the template is to go through this default template.


The template consists of 2 parts, separated by a blank line:

  • The Query section - describes the query necessary to pull all the columns from the log record needed to generate the output.
  • The Output section - describes how to use the queried data to put the actual log entry together.

The Query Section


This specifies the Salesforce object that contains the log information. In this case it is Task, but could be, for example, bloggs__CustomLogObject__c.

Required - Mandatory


Specifies the fields needed in the output section of the template. The Id field is always included.

Required - Mandatory


Specifies a filter that only returns the records to be displayed.

Required - Optional


Specifies the order in which the records should appear on the page, from top to bottom.

Required - Optional


The maximum number of calls to display in the recent call list UI.

Required - Mandatory

The Output Section

The output section consists of one or more lines which use macros to render the queried call log data to the UI.

The first line is always visible, the remainder are hidden unless the user hovers their mouse over the entry in the recent call log, in which case they become visible.

The %% delimiter is used to locate a : in the output, and the text to the left of the %% is output with a label-type class (right justified, italic), whereas the text to the right of the %% is output left justified and in roman font. Note - these attributes can be changed via CSS.

If the evaluated content to the right of the %% is empty, then that line is omitted from the UI.

This construct:

case $null$:, true: 

is used regularly, for the following reason:

The normal behaviour when a variable is null is to substitute the word Unknown. In this case we want null variables to evaluate to, literally, nothing, So the case $null$:, does that. The null case is mapped to the string between the : and the , which is literally nothing. The true: part is required because the Salesforce php library (used by Natterbox's message gateway) returns the string true occasionally when it should return a null string. The true: part of the statement detects this and substitutes the null string.

Line 1

{{{Subject: substr 5}: nicedate %d/%m/%Y %H:%M}: ifnull {CreatedDate: nicedate %Y-%m-%dT%H:%M:%SZ}}%%{{Name: ifnull {FirstName: case $null$:, true:} {LastName: case $null$:, true:}}: case  :{CallObject}}
Before the ifnull
{{Subject: substr 5}: nicedate %d/%m/%Y %H:%M} 

This assumes that the Subject column contains data formatted like this - Call 20/08/2011 10:15. The substr transformation is used to remove the first 5 characters (Call ) and the remainder is treated using the nicedate transformation to generate a user friendly time label for the log. If the above macro fails (usually because someone has later edited the Task Subject so it is now in an unexpected format) then the statement after the ifnull {CreatedDate: nicedate %Y-%m-%dT%H:%M:%SZ} and before the %% is used as a fall back for rendering the line. This instead uses the CreatedDate field of the Task.

After the %%
{{Name: ifnull {FirstName: case $null$:, true:} {LastName: case $null$:, true:}}: case :{CallObject}}

Use Name (this is the name given to the returned Account.Name column) unless it's null, in which case use Contact.FirstName LastName. If that is also null, use the CallObject (which by default contains the other party's phone number).

Line 2


Output the other party's number.

Line 3

Subject%%{Subject: substr 0,100} 

Output the first 100 characters of the log subject.

Line 4

Desc%%{Description: substr 0,100} 

Output the first 100 characters of the log description.

Line 5

Account%%{Name: case $null$:, true:}

Output the associated Account name. If the result is null, the line won't be rendered.

Line 6

Contact%%{{FirstName: case $null$:, true:} {LastName: case $null$:, true:}: case  :}

Output the associated Contact's first name and last name. If the result is null, the line won't be rendered.

  • Was this article helpful?