User Tools


Email Workflow Tasks

TBD

Meta Variables

Comments

This meta variable was created to support the help desk process and permits you to add and format a list of the comments on the ticket to your email.

It also supports the FAQ module and all the other modules that have comments. So, although unlikely, you could send all the comments on an opportunity to the related account or contact, or, more interesting, send them to the user in charge of the opportunity when one is added.

Note that the generic ModComments module is supported separately in the workflow settings, so you can send emails with the comments from there directly and probably have more conditions.

The syntax of this meta variable is:

$(general : (__VtigerMeta__) [dateformat_]comments[_num[sort][_format[_field]]])

where:

dateformatOptional PHP standard date formatting syntax that will be applied to all dates. If not given the date format of the user executing the command will be used
numIndicates the number of comments you want, 0 will retrieve all comments
sorta one letter indicator to sort created time ascending (a) or descending (d)
formattext or html
fieldcreator, comment, date, all: indicates the field to retrieve

Examples

commentsreturns all comments sorted ascending in HTML format, see below for exact format
comments_1d_text_commentreturn in text format the last comment added
comments_1d_textreturn all three fields (creator, date and comment) in text format of the last comment added. Each field will be ended with a new line character
comments_4dreturns last 4 comments in HTML format
comments_4areturns first 4 comments in HTML format
comments_4returns first 4 comments in HTML format
comments_0dreturns all comments sorted descending in HTML format
comments_0d_textreturns all comments sorted descending in text format
d.M.Y - H:i_commentsreturns all comments sorted ascending in HTML format, with specific date format

Styles and Formats

In text format mode the value of the field will be returned with no additional characters unless you asked for all the fields, in that case, each field will be ended with a new line character.

The creator field will be returned as the first and last name of the user or contact.

The date field will be formatted to the settings of the user assigned to the ticket launching the workflow.

If you want to completely set the date format you can use the standard PHP date formatting right after the date field. This only works when retrieving the date field individually:

$(general : (__VtigerMeta__) comments_1d_text_dated.m.Y - H:i)

The comment field will be stripped of any inline style or scripts to avoid potential hacks or compromises of clients computers.

In html format mode all fields will be returned in an unordered list element (UL). Each comment will be in it's own DIV which will contain the unordered list and contain each field being returned in it's own list item (LI).

The whole set of comments will be enclosed in a DIV element.

So the structure looks like this:

<div class="comments">
  <div class="commentdetails">
    <ul class="commentfields">
      <li class="commentcreator">...</li>
      <li class="commentdate">...</li>
      <li class="commentcomment">...</li>
    </ul>
  </div>
  ...
</div>

Since each element has it's own class you can add inline CSS to your email and format the comments as you like.

As an example, this CSS:

<style type="text/css">
.comments {
  margin: 10px
}
 
.commentfields {
  color: brown;
  list-style-type: none;
}
 
.commentfields:hover {
  background-color: #F5FFCC;
}
 
.commentcreator {
  position: absolute;
  font: bold italic 16px/1.5 Helvetica, Verdana, sans-serif;
  word-wrap: normal;
  width: 160px;
}
 
.commentdate {
  font: bold italic 16px/1.5 Helvetica, Verdana, sans-serif;
  padding-left: 170px;
}
 
.commentcomment {
  font: 14px/1.5 Helvetica, sans-serif;
  padding-left: 170px;
  color: #555;
}
</style>

will produce the output you can see in the next image which is from my email reader (thunderbird) with the hover effect captured:


coreBOS Documentación