I have several ticket queues setup for different departments.  I also have some rules that automatically move a ticket from one queue to the other based on certain conditions.
I'm looking for a method to write the value of a custom field as a comment.  I was hoping by defining the custom field in the select statement I could then use that variable in the "Append comment to ticket" the same way I would when sending emails.  However either I'm doing something wrong or that's not supported.

For example
         SELECT
      -- ticket fields
HD_TICKET.CUSTOM_FIELD_VALUE6 AS SETUP_NAME, -- $setup_name
HD_TICKET.CUSTOM_FIELD_VALUE3 AS NMLS_NAME, -- $nmls_name
HD_TICKET.CUSTOM_FIELD_VALUE0 as BRANCH_NAME, -- $branch_name
HD_TICKET.CUSTOM_FIELD_VALUE1 as JOB_TITLE, -- $job_title

If I try to use $setup_name in the "Append comment to ticket" it simply displays as "$setup_name" whereas if I use that in building an email it shows the field value.

Has anybody done this, I'm assuming I will need to do this as an update query.  If anybody has an example on how to make this work that would be great.

2 Comments   [ + ] Show Comments

Comments

  • Looks like you're going to need an update query. Updating into the comments can be a tricky thing. I've found that you actually have to write into two fields. You have to write/update into the HD_TICKET_CHANGE.COMMENT field (which is the 'comment') and then also into the HD_TICKET_CHANGE.COMMENT_LOC field (which holds the actual, visible comment. It has a standard format of: sprintf(_(stripslashes('')), '');

    With a comment inside it looks like; sprintf(_(stripslashes('update')), '');


    So, that being out there, you would need the update query to append to those 2 fields without breaking the formatting.

    You'd need a concat that circumvents all that beginning formatting (which is static) (or just write it into the update statically) and then append the comment.

    something like:
    update HD_TICKET_CHANGE,
    HD_TICKET_CHANGE.COMMENT = HD_TICKET.CUSTOM_FIELD_VALUE1,
    HD_TICKET_CHANGE.COMMENT_LOC = sprintf(_(splitslashes'HD_TICKET.CUSTOM_FIELD_VALUE1)), '') WHERE (HD_TICKET_CHANGE.HD_TICKET_ID in (<TICKET_IDS>))

    That MIGHT work? Give it a shot and play with that update logic?
  • Just wondering if you ever found out a way to do this? I'm trying to do the same thing, but with copying the Resolution as a comment :(
Please log in to comment

There are no answers at this time

Answers

Answer this question or Comment on this question for clarity