Add field’s information into email template

joshmorris
Tera Guru

Hi,

 

When emailing out of a ticket the subject etc is automatically populated based on the short description of the ticket. We have a need to add some fields of the ticket into the body of the email automatically. How can we achieve this!

3 ACCEPTED SOLUTIONS

Anupam1
Giga Guru

Hi @joshmorris ,

 

There are multiple ways:-

Option 1: Modify the Email Template or Notification

If you're using Notifications or Email Templates, you can insert field values using template variables:

Example:

Hello,

 

Here are the details of your ticket:

 

- Number: ${number}

- Short Description: ${short_description}

- Priority: ${priority}

- Assigned To: ${assigned_to.name}

- State: ${state}

 

Thank you,

Support Team

  • These variables pull directly from the record (e.g., Incident, Change).
  • You can use dot-walking for related fields (e.g., ${assigned_to.name}).

 

Option 2: Customize the Email Client (Email UI Action)

If you're emailing manually from a ticket using the Email Client, you can:

  1. Create a custom UI Action that opens the email client with pre-filled body content.
  2. Use a script like this:

var body = "Hello,\n\nHere are the ticket details:\n";

body += "Number: " + current.number + "\n";

body += "Short Description: " + current.short_description + "\n";

body += "Priority: " + current.priority + "\n";

body += "Assigned To: " + (current.assigned_to.name || "Unassigned") + "\n";

 

action.setRedirectURL("mailto:" + current.caller_id.email + "?subject=" + current.short_description + "&body=" + encodeURIComponent(body));

 

Option 3: Use Email Scripts for Advanced Logic

In Notifications, you can use Email Scripts for more control:

<mail_script>

var details = "Ticket Details:\n";

details += "Number: " + current.number + "\n";

details += "Short Description: " + current.short_description + "\n";

details += "Priority: " + current.priority + "\n";

details += "Assigned To: " + (current.assigned_to.name || "Unassigned") + "\n";

template.print(details);

</mail_script>

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

 

Best,

Anupam.

 

 

 

 

 

 

View solution in original post

AndrewR94052681
Mega Sage

Hey @joshmorris this is really simple to achieve just follow the below steps...

 

  1. Go to System Notification > Email Templates or just notifications if you’re using those.
  2. Open the template or notification linked to your table (e.g., Incident, Task, Change).
  3. In the Message Body, insert field variables using Glide syntax, for example:
Hello ${user.name},  
Here are the ticket details:  
Number: ${number}  
Priority: ${priority}  
Short Description: ${short_description}  
Description: ${description}
Assigned To: ${assigned_to}  

 

Please mark as helpful or if it’s resolved the issue, CORRECT! ✅ 

View solution in original post

AndersBGS
Tera Patron

Hi @joshmorris 

 

when creating the template you can use the dates available by drag and drop.

 

View solution in original post

3 REPLIES 3

Anupam1
Giga Guru

Hi @joshmorris ,

 

There are multiple ways:-

Option 1: Modify the Email Template or Notification

If you're using Notifications or Email Templates, you can insert field values using template variables:

Example:

Hello,

 

Here are the details of your ticket:

 

- Number: ${number}

- Short Description: ${short_description}

- Priority: ${priority}

- Assigned To: ${assigned_to.name}

- State: ${state}

 

Thank you,

Support Team

  • These variables pull directly from the record (e.g., Incident, Change).
  • You can use dot-walking for related fields (e.g., ${assigned_to.name}).

 

Option 2: Customize the Email Client (Email UI Action)

If you're emailing manually from a ticket using the Email Client, you can:

  1. Create a custom UI Action that opens the email client with pre-filled body content.
  2. Use a script like this:

var body = "Hello,\n\nHere are the ticket details:\n";

body += "Number: " + current.number + "\n";

body += "Short Description: " + current.short_description + "\n";

body += "Priority: " + current.priority + "\n";

body += "Assigned To: " + (current.assigned_to.name || "Unassigned") + "\n";

 

action.setRedirectURL("mailto:" + current.caller_id.email + "?subject=" + current.short_description + "&body=" + encodeURIComponent(body));

 

Option 3: Use Email Scripts for Advanced Logic

In Notifications, you can use Email Scripts for more control:

<mail_script>

var details = "Ticket Details:\n";

details += "Number: " + current.number + "\n";

details += "Short Description: " + current.short_description + "\n";

details += "Priority: " + current.priority + "\n";

details += "Assigned To: " + (current.assigned_to.name || "Unassigned") + "\n";

template.print(details);

</mail_script>

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

 

Best,

Anupam.

 

 

 

 

 

 

AndrewR94052681
Mega Sage

Hey @joshmorris this is really simple to achieve just follow the below steps...

 

  1. Go to System Notification > Email Templates or just notifications if you’re using those.
  2. Open the template or notification linked to your table (e.g., Incident, Task, Change).
  3. In the Message Body, insert field variables using Glide syntax, for example:
Hello ${user.name},  
Here are the ticket details:  
Number: ${number}  
Priority: ${priority}  
Short Description: ${short_description}  
Description: ${description}
Assigned To: ${assigned_to}  

 

Please mark as helpful or if it’s resolved the issue, CORRECT! ✅ 

AndersBGS
Tera Patron

Hi @joshmorris 

 

when creating the template you can use the dates available by drag and drop.