Write Ticket Values as a Comment
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
Answers (0)
Please log in to answer
Be the first to answer this question
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? - Wildwolfay 10 years ago