I created this rule since I wanted a way to send the users a KB article that has HTML or markup in it. Currently the system would post the html code in a comment if using the KACE built in KB article lookup. So here's the steps I took to do this....

1. Go to the Service Desk Module > Configuration > Queues > "Specific Queue" > Queue Customization

2. Add a Single Select custom field with select value of query: select TITLE from ADVISORY and nothing in the default box.

3. Click Save and Continue

4. Edit the custom field in the Ticket Layout with the name KB Article Link and make it Owner Only - Hidden from User

5. Keep track of the custom field value. For example: CUSTOM_6 

6. Go to Service Desk Module > Configuration > Rules > "Specific Queue"

7. Click on Choose Action...  and choose New (SQL)

8. Name: KB Article Rule Insert. (Or whatever else you wanna call it)

Select Query:

select distinct(HD_TICKET.ID) from ADVISORY A, HD_TICKET

left join HD_TICKET_CHANGE on HD_TICKET_CHANGE.ID = <CHANGE_ID>

where HD_TICKET.CUSTOM_FIELD_VALUE5 = A.TITLE   <--- Custom Field Number - 1 (CUSTOM_6 = CUSTOM_FIELD_VALUE5)

and HD_TICKET.HD_QUEUE_ID = 1   <--- INSERT QUEUE ID HERE

and HD_TICKET_CHANGE.HD_TICKET_ID = HD_TICKET.ID

Update Query:

update HD_TICKET, HD_TICKET_CHANGE, ADVISORY

set HD_TICKET_CHANGE.COMMENT = concat("http://KBOXURL/userui/advisory_detail?ID=", ADVISORY.ID),

HD_TICKET.CUSTOM_FIELD_VALUE5 = ''  <--- Custom Field Number - 1 (CUSTOM_6 = CUSTOM_FIELD_VALUE5)

where HD_TICKET.HD_QUEUE_ID = 1  <--- INSERT QUEUE ID HERE

and ADVISORY.TITLE = HD_TICKET.CUSTOM_FIELD_VALUE5   <--- Custom Field Number - 1 (CUSTOM_6 = CUSTOM_FIELD_VALUE5)

and HD_TICKET_CHANGE.HD_TICKET_ID = HD_TICKET.ID

and HD_TICKET_CHANGE.ID = <CHANGE_ID>

and HD_TICKET.ID in (<TICKET_IDS>)

Schedule: On Ticket Save


9. As an owner you can go to the drop down in the ticket detail view and select a KB article you want to send to the user. When you save the ticket it will add a comment with a link to the KB article.


If you need help getting the queue ID make sure you are using KBOXaddress/adminui and go to the queue settings. You will see at the top it will say something like: queue.php?ID=1 meaning that is queue #1