/build/static/layout/Breadcrumb_cap_w.png
11/26/2018 124 views

I'm trying to figure out if it is possible to insert a comment with the result of a SQL query. It appears that the built in "Append comment to ticket" option is just a static/stagnate field that just dumps what's in the box into a comment. What I need is a way for adding a more dynamic comment. For instance:

  1. I have a drop down menu assigned to Custom Field 1.
  2. On ticket save, a custom rule checks if there is now data in Custom Field 1.
  3. If data is there, run update query to add a comment with the results of Custom Field 1 and then reset the field to blank.

Is it possible to add that kind of comment during the update query?


Thanks!!

4 Comments   [ + ] Show comments

Comments

  • Hi Techman D,

    I've been looking into the best way to do this. Long story short, I can't get it to work the way you want. I'm not sure how much you have dug into this, but:
    Using the Wizard as a starting point, we can very easily accomplish the "On ticket save": if Custom Field 1 != "", then set Custom Field 1 = "".

    This gives us the SQL that we need.

    The issue is that the "Append comment" does not expose the variables. Variables appear to only be exposed on the "Email each recipient in query results".

    Would using an email notification be helpful to you?

    I'll keep digging on this, as I am unsure of the limitations of using the Update SQL (as now I'm curious myself).

    Let me know if this helps or if you figure it out.
  • Hey aarmington,

    Thank you for looking into this. I have a separate rule that works properly checking a custom field, sending an email using variables, and then clearing the field.

    The comment is the hang up. I would like to have a comment added with the specifics of that custom field. I, too, found that the variables seem to only be exposed to the email section and I have found nothing that explains a way to work around this.

    A little more information:
    I am trying to create field that would allow an owner to select a knowledge base article from a drop down. I know there is already an option for that built in, but it dumps the plain text from the KB into the comment. This is useless for KBs that are written in markdown that have numbered steps or pictures. To drive more traffic to the KB article itself (increasing views and maybe ratings), I created the field with the hopes of writing a rule that would check if a KB was selected in the custom field, and then providing a URL to the article in a comment.

    My workplace uses the comment field for documentation purposes. Every step, communication, update from vendor, all of it is tracked in the comments. Having the flexibility to use the comment field, I would imagine, would be beneficial in other circumstances.
  • Hi Techman,

    I've been looking into this. I think it can be done in a roundabout way, but it's going to involve some SQL and various ticket rules. Hilariously enough, I am now interested in implementing this myself. This is a rather interesting shortfall in the current system. I'll keep you updated if I make any breakthroughs on this.
  • Hey aarmington,

    That's awesome! Yea, I don't know why it isn't an option already. Seems a little silly. There is a request for more flexibility with the comments in ticket rules on UserVoice so, anyone interested, please vote:
    https://kace.uservoice.com/forums/82699-sma-k1000/suggestions/8066940-allow-ticket-rules-to-insert-sql-variables-varia

    Thank you again!

There are no answers at this time