Adding on-post controls to mark as answered, closed, etc.

19 Comments

  • Alex Culligan

    Hi there.

    The usual drop-down menu works by making an API call when clicking on the button, but if you try to access that URL, you see that you get an error message. So trying to dissect that menu doesn't really help much.

    That being said, you can make the same API calls using JavaScript, but it requires quite a bit. 

    The code can be found here.

    5
  • Carsten Falborg
    Community Moderator

    Good work Alex... Saving this for future reference! :-)

    0
  • Pulse

    Dude... Alex... not only answered in decent time, but knocked out of the park with a working solution with full on code and everything! You are THE MAN!

    Given your amazing expertise, you might be able to provide an answer on the following... we've got some other customization going on, a bunch of stuff I've kludged into place with JS, one of which is to highlight the background of posts for our moderator team to show if a post has a ticket attached. The problem is it doesn't show us if that ticket is solved, just that there is a ticket for a particular post. Any idea how I might have it look up if the ticket is solved to return a different (or remove) the highlighting?

    0
  • Pulse

    Hmmm... added the code, no errors there, but it seems the post isn't being marked as answered or closed, but the "official answer" is selected and returned.

    0
  • Alex Culligan

    Hi.

    Couple of things:

    1. Did you add both the HTML and JS code as I had it?
    2. Did you change SUBDOMAIN for your actual subdomain in the JS?
    3. Are you just previewing or did you save and publish the changes? This won't work when previewing because we're getting the post ID from the URL.

    About your other question: it should be possible by getting the ticket ID from the comment post, then making an API call to check the status of the ticket and act based on that. I'll try to get something on that later.

    0
  • Pulse

    Hey Alex,

    Yes, yes and yes - the boxes show up and I've made sure to include all the code (including my subdomain) in the JS, but checking the boxes and submitting the post didn't result in the post closing or marked as answered. There are no errors in the JS as everything else works properly.

    <scratches head>

    ??

    0
  • Alex Culligan

    I have an idea of what might be going on. Just for reference, what template are you using? and what browser are you using?

    0
  • Jennifer Rowe
    Zendesk Documentation Team

    Alex! I thought you worked at Zendesk. Haha. 

    When you get the issue sorted out (if there is one...) we'd LOVE for you to post this as a community tip! And I'll give you a t-shirt. :)

    1
  • Alex Culligan

    It turns out that IE didn't like the timeout function I had, so I changed that. I also noticed that Safari will not perform both tasks if the page refreshes too soon, so I changed that too.

    I also added and moved other bits here and there, so I recommend you copy everything again.

    I tested it using Copenhagen and The Humble Squid themes, and using IE, Safari and Chrome. No issues to report. Here is a gif :)

    We'll get to the solved ticket bridge later :P

    @Jennifer: I used to. I still check things on here every now and then, and keep my app updated. I'd be happy to make this a tip.

     

    0
  • Pulse

    @Alex > It's Humble Squid, using Chrome on OS X 10.11 and 10.10 had the same result after replacing with the new code. I see the page reload, but it's not closed or "answered."

    O_o

    0
  • Alex Culligan

    hmmm interesting. I have it working on The Humble Squid too (gif).

     

    0
  • Jennifer Rowe
    Zendesk Documentation Team

    Alex, aha! That explains it. Thanks for checking in and helping out here. I know you've got the skills! And thanks too for posting the tip!

    1
  • Pulse

    Wherever I added the alert, it would alert me, but without it, the post remained open and un-answered.

    I added an alert debug to the "markSuccess" check, and it would return the alert with nothing else happening as well.

    Colour me confused because everything else in your code looks like it works as expected!

    0
  • Alex Culligan

    Unfortunately, I can't take a look at that for you. Hopefully we get someone else to test this and see what results they get. If you have an Enterprise account, you could test it in a Sandbox that has Community V2 and with nothing else on the JS page but the default code.

    0
  • Pulse

    Tested in a sandbox, worked there... it's entirely possible we have other JS causing the page not to pass the code properly.

    Would you have any further recommendations for troubleshooting? I'd love to have this addition working for my team!

    0
  • Alex Culligan

    I have changed the code to make it work faster and without the need to refresh the page.

    Also, I had forgotten to post something about the ticket status for the comments that have a ticket. That can be found here.

    1
  • Alex Culligan

    Were you able to test with the new code?

    0
  • Lenka Prochazkova

    @Alex, Great work. I am thrilled to try it out at our help center.

    @zendesk I am wondering why this is not built in the community post. I think it will be cool if all the users not only support agents could mark the answer that helped them and closed the post thread similar as Stackoverflow.com and dropbox community do it :)




    0
  • Nicole S.
    Zendesk Community Team

    Thanks for the feedback, Lenka. 

    0

Please sign in to leave a comment.

Powered by Zendesk