You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-08-14 14:09:19

Gibraltar
Member
From: Lisboa
Registered: 2023-04-03
Posts: 48

Mail receiver tickets and categories

Hi,

Any idea how to implement opening tickets to specific categories from a mail receiver, assuming the email comes with the text "Category: yada yada"?

The ideia is to have an external system send emails with a certain category in the body that gets read by GLPI (regex?) and create the ticket on the category referenced in the email. Not realy shure if this is possible nor how to implement this (using rules) for several categories.

Any ideas?

Thanks.

Offline

#2 2023-08-14 18:10:57

Gibraltar
Member
From: Lisboa
Registered: 2023-04-03
Posts: 48

Re: Mail receiver tickets and categories

I've successfully tested a possible solution using rules that check the email subject for pre defined categories and then assign that category. It's functional but not optimal since it requires creating one rule for each category we want to use and of course configuring the external system to add to the email subject the category (we have dozens).

Anyone have a more efficient idea?

Offline

#3 2023-08-15 14:58:23

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: Mail receiver tickets and categories

Hello,

Yes, this should be possible.
In a ticket business rule add a criteria for Subject Email Header with the operator of "regular expression matches" and the value of a pattern to capture the category name. A simple pattern for that is "/Category: (.*)/", but depending on your needs that may need changed to be more strict.
Then, add a "Category (by completename)" action with "Assign the value from regular expression" and a value of "#0" which will resolve to the result of the regex capture.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#4 2023-08-16 17:38:51

Gibraltar
Member
From: Lisboa
Registered: 2023-04-03
Posts: 48

Re: Mail receiver tickets and categories

Hi cconard96,

Your solution is way better then mine since it would allow me to have one rule to rule them all (pun intended wink

Problem I'm having is with creation of the action. What I've done (keep it simple just to test the flow):
1- create a new category "test"
2- Create a new rule with criteria "Subject email header", Condition "regular expression matches" with value "/(test)/"
3- Add Action to the rule "Ticket category from code" and Action Type "Assign the value from regular expression" with value "#0"

If I send an email to GLPI with only "test" in the email subject, the ticket gets created but without any category.

I'm thinking about the action you mentioned "Category (by completename)" and this does not show up to me. I only have "Ticket category from code" (that allows the option assign from regular expression) and the other action is "Category" with the only option being "Assign" (and this only allows me to select from the ITIL Categories pulldown (can't input free text like #0).

Could it be that the action "Category (by completename)" is not showing for some reason?

I'm on GLPI 10.0.9.

Thank you.

Last edited by Gibraltar (2023-08-16 17:49:39)

Offline

#5 2023-08-17 03:47:49

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: Mail receiver tickets and categories

Sorry, it looks like I was testing on the main branch which is the next major version (10.1.0) and not 10.0. The action option for Category by completename was added a while ago, but only for the next version.
https://github.com/glpi-project/glpi/pull/13290

You should be able to use the Ticket category from code option, but you would have to fill that field out for each category so it matches your category name.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#6 2023-08-17 18:34:00

Gibraltar
Member
From: Lisboa
Registered: 2023-04-03
Posts: 48

Re: Mail receiver tickets and categories

Hi,

Thanks for clearing that up. Will wait for v10.1.

Offline

Board footer

Powered by FluxBB