📘

Templates in Subjects

Remove line breaks to add a template to Subject field of outgoing emails.

Last Editor

This code inserts name of the user who performed most recent modification of an item.

#if ($entity.LastEditor)
  <span>Modified by:</span><br>
  ${entity.LastEditor.FullName}
#end

Assigned Users

This code inserts names and roles of the users assigned to an entity.

#if ($entity.TeamsCollection.Count > 0)
  Assignments:<br>
  #foreach($team in $entity.TeamsCollection)
    ${team.Role.Name} - ${team.User.FullName}<br>
  #end
#end
#if ($entity.General.TeamsCollection.Count > 0)
  Assignments:<br>
  #foreach($team in $entity.General.TeamsCollection)
    ${team.Role.Name} - ${team.User.FullName}<br>
  #end
#end

Custom Fields

A Targetprocess entity may have multiple custom fields. This code displays name and value of a certain custom field:

#if ($entity.Kind.ToString() == 'UserStory')
    #foreach($cf in $entity.CustomFields)
        #if($cf.Name == "My Field")
             #if ($cf.Value)
                 <div>${cf.Name} : ${cf.Value}</div>
             #end
        #end
    #end
#end
#if ($entity.General.Kind.ToString() == 'UserStory')
    #foreach($cf in $entity.General.CustomFields)
        #if($cf.Name == "My Field")
             #if ($cf.Value)
                 <div>${cf.Name} : ${cf.Value}</div>
             #end
        #end
    #end
#end

Terms

Use process-specific Terms for types of entities.

#if (!$entity.ParentProject.IsDefault && $entity.ParentProject.Process)
  $entity.ParentProject.Process.FindAndReplaceTerm(${entity.EntityType.HumanReadableName}) 
#else
  ${tool.Term("${entity.Kind}")}
#end
#if (!$entity.General.ParentProject.IsDefault && $entity.General.ParentProject.Process)
  $entity.General.ParentProject.Process.FindAndReplaceTerm(${entity.General.EntityType.HumanReadableName})
#else
  ${tool.Term("${entity.General.Kind}")}
#end

Use Terms from Default process:

${tool.Term("${entity.Kind}")}
${tool.Term("${entity.General.Kind}")}

Open URL in Chrome

<a href="chrome${tool.Url($entity.General, $user)}">${entity.General.Name}</a>