Link ticket and article


Hello everyone,

I am trying to find a way to link articles to tickets. I have a custom field for tickets, “category”, which has to be manually assigned. I want to have the same custom field for articles and link the articles to the tickets this way. For example, when someone manually assigns a category to a ticket, let’s say “category 1”, I want the article with category “category 1” to appear. Is there a way to create this mapping?


I assume you’ve discounted just linking the article to the ticket using the “New Links” section of a ticket’s Link menu?


Yes I know that function. But my aim is to link article to ticket automatically. I want the article with the same category to show up when a category is (manually) assigned to a ticket. The user should not have to manually link the articles to every ticket. Is it possible? Can I use SLA for this purpose?


Is there a 1:1 mapping of categories to articles?


It should be possible to write a scrip that checks for when the custom field ‘category’ is set on a ticket to also add a link to article X.


Yes, I was just wondering if the category in the ticket would lead to a single article, or whether it would be multiple articles. But a scrip was what I was thinking as well. It would need to be able to unlink the artcles(s) from the ticket if the category was changed as well.


Thanks for your comments, it helped me a lot. Yes map between article’s category and ticket category is 1:1.

I managed to write a scrip with a working condition (namely when a category is changed).
However, I have a few issues with the action part. I want to add a link to an article based on the new value of the category field. This would work as follows:
In the tickets, I have a customfield called ‘Category’ with several custom values. For each of these values there is a name and an ID.
On the other hand, for the articles I also have a customfield called ‘Category’ , which is just a name.
Now whenever a category of a ticket is changed, I would add a link to the article with the same category as the new value of the category of the ticket.

The AddLink method can be used to create a link from the scrip of a ticket to the article of my choosing. However, when I create this link, the article parameter is given by ’ a:[id]’ , where [id] is the id of the article. At this point, I have managed to retrieve the new value of the category of the ticket, but I do not know how to retrieve the id of the article with the same category.

This is the code I used to retrieve the new and old category values.
my $oldcat= $self->TransactionObj->OldValue;
my $newcat= $self->TransactionObj->NewValue;