Trigger firing 2 URL targets not working consistently

14 Comments

  • Jessie Schutz

    Hey Andrew!

    So here's what I'm thinking. When the ticket is submitted, the CC isn't technically on there until the ticket is finished updating. So when you're also adding a public comment at the same time, the public comment will be added to the ticket when it's updated, but at the moment that notification email would be sent, the CC'd user isn't technically there yet. Hence the notification is never sent.

    Does that make sense? This mainly conjecture, but seems like the most likely culprit to me. Since you're working with URL targets, the timing of everything might be a bit wonky compared to regular triggers.

    I would at least test it with a single target per trigger and see if you don't have more luck with it.

    Without knowing the exact use case it's hard to make other suggestions...you might be able to rig something up with individual CC notification triggers and tags so that whatever you want to to tell the CC'd person would go out in that notification instead. I'm just spitballing.

    Feel free to share more detail! I'm happy to noodle it over with you.

     

    0
  • Andrew J

    Hello Jessie,

    Slight re-iteration...

    1. I have just one trigger... it is firing fine.
    2. The trigger fires two independent URL targets
    3. The second target only places a comment on the ticket - at this point, it isnt managing to do this reliably
    4. When it does work - it is placing a private comment rather than a public one

    I am suspecting I will need to use 2 triggers to step it through the process a bit slower.

    Trouble is I have 14 of these to make, and that means 28 triggers and 28 targets... 

    Maybe I should learn more about HTML targets :)

    Exact use case is...

    We are wanting to involve a 3rd party contractor in some tickets, but have our agent still own it.  We are wanting to add the contractor as a CC via a macro (will add multiple emails at times).  Using the macro is to simplify the process, and eliminate mistakes.  Our agents might not remember the contractor, but will just add a macro for the right region.

    We can't add the contractor to CCs directly via the macro - therefore we are using the URL target.  

    We need to send a message to the contractor after adding them as a CC... I guess we could do this via another trigger, and not worry about the second URL target.

    Our triggers and targets screen is getting a bit unmanageable!

    0
  • Colin Piper

    @Andrew, definitely switch over to http targets -- so much more powerful and you can updated any field or multiple fields at once. 

    The problem with any Notification action is that it does not actually happen immediately (well not in my testing) so you cannot rely on the result to occur in the same trigger "cycle". If you are lucky the change that you make will create a subsequent update event and then the second trigger may fire but of course perhaps other conditions would no longer be true as those changes occurred for the previous cycle.

    0
  • Andrew J

    Thanks Colin - I'll have another look at HTTP targets.  I haven't found any article that demystifies it for someone of my small IQ yet - they seem to assume that I know the basics of some Martian language already.  Any suggestions?

    I'm pretty sure that if I used 2 triggers for each it would work ok, but thats 28 triggers... I'm going to look for some dynamic solution...

     

    0
  • Colin Piper

    Setting up an http target is simple:

    Url: https://domain.zendesk.com/api/v2/tickets/{{ticket.id}}.json

    Method: PUT

    Content Type: JSON

    Then add your api authentication

    Using the notification in a trigger is just a case of using the api. Perhaps some examples will inspire you.

    {"ticket": {"recipient": "accounts@domain.com", "custom_fields" : [{"id":19713728, "value": true}]}}

    In this example I set two fields on the "ticket" object. The first is the Recipient field which is not available through they UI. The second is a custom dropdown field. You can add as many pairs (field name, field value) as you wish to the JSON statement.

    Here is another example:

    {"ticket": {"comment": {"public": false, "body": "Ticket escalated to the Accounts group by {{current_user.name}}\nType of Issue: {{ticket.ticket_field_option_title_11818801}}"}}}

    In this example I add a private comment to a ticket using placeholders also.

    0
  • Andrew J

    Thanks Colin.  I'll give it a go :)

    I reckon I might be able to get it down to 2 triggers and one target with some dynamic content :)

     

     

    0
  • Jessie Schutz

    Yeah, I think I could have phrased my answer better. :P I'm glad that somebody smarter than me jumped in to help! :D

    0
  • Andrew J

    DC alone isn't going to work by the looks - see https://support.zendesk.com/hc/en-us/articles/203662116-Using-placeholders?page=1#comment_204563938 and https://support.zendesk.com/hc/en-us/community/posts/208785517-Placeholders-within-Placeholders-possible-

    Will keep working away at what Colin is suggesting... now I need to learn liquid :)

     

    0
  • Andrew J

    How about just adding the ability to add a user CC in a macro and letting my poor brain stop fizzing and popping. :-)

    0
  • Colin Piper

    @Andrew....and where's the fun in that :)

    0
  • Andrew J

    That is a good point Colin...

    Officially reporting - I have made some progress!

    My Dynamic Content (ONE DC item!) looks like this...

    -----------------

    {% case ticket.ticket_field_403448257 %}

    {% when 'site_1' %}    
    contractor1@mail.com

    {% when 'site_2' %}
    contractor2a@mail.com,contractor2b@mail.com,contractor2c@mail.com

    {% else %}
    ERROR
    {% endcase %}

    -----------------

    The adding of CCs works... so YAY!

    I am now going through and adding the 21 cases, all the contractor user accounts... then will do the 21 macros...

    But it looks good.

     

    0
  • Andrew J

    URL target looks like this;

    {{dc.contractor_email}}{% for cc in ticket.ccs %},{{cc.email}}{% endfor %}

     

    Whole process goes like this.

    Agent applies macro for region

    Macro adds value to custom field - 'region'

    Macro adds tag 'add_contractor_cc'

    Update ticket

    Trigger checks for tag above

    Fires to the target

    Target uses the DC content to input correct CCs which are added to the ticket

     

    Next I just need to add a notification to the contractor - but now that I have the CC added this shouldnt be too hard.

    I already have the first trigger adding a tag 'notify_contractor', so a following trigger will check for this.  Hopefully there is enough delay to ensure the URL target adds the CCs first.  Otherwise I might need to use an automation instead, or maybe just use the same DC again to email the contractor.

    0
  • Andrew J

    So close...  I'm seeing an issue where my 'Public' comment is not displaying on the ticket comment stream unless I go into 'View all notifications'.

    Any idea why that would be?

    0
  • Colin Piper

    Honestly I would use the newly updated http target not the url target then some basic JSON and you can update every field at once and add comments and cc.

    The delay may still be an issue so what I do is to set a custom field at the same time and wait to send my notification until the update occurs when that custom field has changed. 

    I can add more detail later if needed? 

    0

Please sign in to leave a comment.

Powered by Zendesk