Get-EmailTemplate

Prev Next

Summary

Retrieves an existing email template.

Get-EmailTemplate
    -Id

Returns an email template object.

Parameters

Parameter

Type

Required?

Notes

Id

Int32

Yes

The email template id.

Examples

Get an existing email template

This example retrieves a specific email template and outputs it as JSON.

# Retrieve a specific email template by id
$entity = Get-EmailTemplate -Id 1

Write-Output "Retrieved email template $($entity.EmailTemplateId) (Name: $($entity.Name))"

# For debug purposes, convert the email template to output as JSON so we can see the available fields
Write-Output ""
Write-Output "JSON Results:"

$jsonOutput = $entity | ConvertTo-Json -Depth 10

# Output the task
Write-Output $jsonOutput
Retrieved email template 1 (Name: Task Completed)

JSON Results:
{
  "EmailTemplateId": 1,
  "Name": "Task Completed",
  "Description": "A simple message to indicate that a task has been completed.",
  "Subject": null,
  "Template": "<p>Greetings,</p><p>The <span class=\"label label-primary ab-mention\" contenteditable=\"false\" data-field-template-id=\"@{TASK_NAME}\" title=\"Token Id: @{TASK_NAME}\">Task Name</span>&nbsp;task has just been completed by <span class=\"label label-primary ab-mention\" contenteditable=\"false\" data-field-template-id=\"@{TASK_COMPLETED_BY_FULL_NAME}\" title=\"Token Id: @{TASK_COMPLETED_BY_FULL_NAME}\">Completed By</span>&nbsp;on <span class=\"label label-primary ab-mention\" contenteditable=\"false\" data-field-template-id=\"@{TASK_COMPLETED_ON}\" title=\"Token Id: @{TASK_COMPLETED_ON}\">Completed On</span>. It was assigned by <span class=\"label label-primary ab-mention\" contenteditable=\"false\" data-field-template-id=\"@{TASK_ASSIGNED_BY_FULL_NAME}\" title=\"Token Id: @{TASK_ASSIGNED_BY_FULL_NAME}\">Assigned By</span>&nbsp;on <span class=\"label label-primary ab-mention\" contenteditable=\"false\" data-field-template-id=\"@{TASK_ASSIGNED_ON}\" title=\"Token Id: @{TASK_ASSIGNED_ON}\">Assigned On</span>.</p><p>Thank you,<br /><span class=\"label label-primary ab-mention\" contenteditable=\"false\" data-field-template-id=\"@{INITIATOR_NAME}\" title=\"Token Id: @{INITIATOR_NAME}\">Email Initiated By</span> </p>",
  "IsEnabled": true,
  "CreatedByFullName": "Adam Chavez",
  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "CreatedOn": "2018-12-27T13:12:06.8894343-06:00",
  "CreatedBy": null,
  "LastUpdatedByFullName": "Adam Chavez",
  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "LastUpdatedOn": "2023-11-30T12:39:58.0417555+00:00",
  "LastUpdatedBy": null,
  "NumberOfAssociatedContacts": 1,
  "AssociatedContacts": []
}