How can I reveal CCs in a notification email using Liquid markup?

Return to top
Have more questions? Submit a request

41 Comments

  • Eli Webster

    If you want them to appear on multiple lines, and you wanted your custom text to only show if there are actual CC's, and you wanted even your own agents to show up as being CC'd, I would do this:

    The first line is just standard "CC E-mail" text. You can remove it if you don't want it.

    You are registered as a CC on this help desk request (#{{ticket.id}}). Reply to this email to add a comment to the request.

    {% if ticket.cc_names != empty %}
     {% capture ccedusers %}
     {% for cc in ticket.ccs %}
       {{ cc.name | prepend: '"' | append: '" '}} {{ cc.email | prepend:'<' | append: '>' }}
     {% endfor %}
      {% endcapture %}
    {% if ccedusers contains '@' %}
     Here is where you custom text would go and would only show if there is a CC.

     {{ ccedusers | replace:'&quot','"' | replace:'&lt','<' | replace:'&gt','>' | replace:';','' }}
    {% endif %}
    {% endif %}
    {{ticket.comments_formatted}}

    Keep in mind the lines that append and prepend are used for housekeeping. It basically changes something like:

    John Smith jsmith@domain.com

    to

    "John Smith" <jsmith@domain.com>

    which is more in line with standards. And the lines that replace is because I found it sometimes to show the word "&quot" so it changes it to just an actual " sign.

    0
  • Pepijn van de Vondervoort

    Thanks Eli.

    Question: when there are no CC'd persons in the ticket, your code is automatically hidden. Thats great!

    But that does leave some unnecessary white space (enters) behind which isn't very neat.

    Is it somehow possible to remove this side-effect?

    0
  • Raman Kalia

    Resurrecting the thread. I'm trying to add a tag in the ticket if CC field is not empty. Following code is being called but not working.

    {% if ticket.cc_names != empty %}

    {“ticket”: {“additional_tags”: [“cc_true”]}}

    {% else %}

    {% endif %}

    HTTP Target - https://mysubdomain.zendesk.com/api/v2/tickets/update_many.json?ids={{ticket.id}}

    Have also tried in place of {% if ticket.cc_names != empty %} with no success.

    {% if ccedusers != empty %}
    or
    {% if ccedusers contains '@' %}

    Any idea...

    0
  • Santiago Saez

    Hi,

    Is there any way to filter by organization? 

    I only want one organization to recieve the CCs to try for a few weeks and have some feedback.

    I've tried adding {% if user.organization.name contains 'XXXX' %}

    but it's not working

     

    thanks!!

    0
  • Eli Webster

    Why not change the first "unless" to an "if", like this (taken from my post 3 years ago):

     

     {% if cc.email contains 'clientdomain.com' %}
      {% unless forloop.last %}
       {{ cc.name | prepend: '"' | append: '" '}} {{ cc.email | prepend:'<' | append: '>, ' }}
      {% else %}
       {{ cc.name | prepend: '"' | append: '" '}} {{ cc.email | prepend:'<' | append: '>' }}
      {% endunless %}
     {% endif %}
    0
  • Donald Cornel

    Hello, Is there a way to modify message body of the requester to receive different from the one sent to CC email thru this liquid markup?

    something like:

    Message to requester: "Your request has been updated."

    Message to CCs: "You were copied on this ticket."

    0
  • Dan Ross
    Community Moderator

    Hey Donald Cornel

    You can actually avoid Liquid entirely here. You can configure the CC template independently of whatever you send to Requesters. The template control for CCs is found under your admin panel, under the 'Tickets' Section. 

    0
  • Thomas Joussot

    Hi Dan,

    I guess there is no CC template once 'Ccs and Followers' is enabled, right?

    0
  • Donald Cornel

    Hi Dan,

    What I can see from the Tickets settings, only Followers has email template that can be modified.

    For CCs there's none.

    0
  • Brett Bowser
    Zendesk Community Team

    @Donald and Thomas,

    That is correct. You'd need to edit the trigger instead that would be sending out the CC notification.

    0
  • Donald Cornel

    Thanks @Brett for confirmation.

    Anyone has an idea how to customize the message for all CCs only?

    0

Please sign in to leave a comment.

Powered by Zendesk