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 2013-10-02 11:28:03

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Create tickets 'On Behalf Of' via emails

Dear all,
We have implemented in a plugin the possibility to send emails to GLPI 'On Behalf Of' another requester.
I explain:
- when an email is sent to GLPI, the requester of the created ticket is the sender of the email.
- when technicians receive directly emails from a requester (happens often), they can't forward these emails to GLPI (otherwise the requester is not correct and the entity too), they must copy/paste the body of the received emails and select the requester in the list.
- to reduce this process: the idea is to forward the emails to GLPI with a special tag (we choose "##From: lastname, firstname" set in the body of the forwarded email) and to change the  $parm->input['_users_id_requester'] within a plugin during the 'pre_item_add' hook.

This is perfect! it works and we can forward email to GLPI 'On Behalf Of' the original sender.

But in the created ticket the Originator (=Writer) is the Requester, and not the Forwarder, and we would like to trace the real writer of the ticket (i.e. the forwarder and not the requester).

I found in 'commonitilobject.class.php' function 'prepareInputForAdd()' line 895 the following code which is executed when a ticket is created via mailgate:

 // No Auto set Import for external source
      if (($uid=Session::getLoginUserID()) && !isset($input['_auto_import'])) {
         $input["users_id_recipient"] = $uid;
      } else if (isset($input["_users_id_requester"]) && $input["_users_id_requester"] )) {
         $input["users_id_recipient"] = $input["_users_id_requester"];
      }

This code means that Writer (or Originator) will be set to Requester everytime when ticket is created via extenal source...

could it be possible to change it to:

 // No Auto set Import for external source
      if (($uid=Session::getLoginUserID()) && !isset($input['_auto_import'])) {
         $input["users_id_recipient"] = $uid;
      } else if (isset($input["_users_id_requester"]) && $input["_users_id_requester"] && !isset($input["users_id_recipient"])) {
         $input["users_id_recipient"] = $input["_users_id_requester"];
      }

which means Writer (or Originator) will be set only when not already set ?

thank you,
regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#2 2016-03-15 11:56:36

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello,
This feature has been implemented into the mailanalyzer plugin, here http://plugins.glpi-project.org/#/plugin/mailanalyzer but not documented,
Any received emails which contains in the message body a text that matches the following regex:

/##From: ([_a-z0-9-\' ]+), ([_.a-z0-9- ]+)/i

will be created with requester the person mentioned after the ##From

But it has currently some restrictions:
1) The mentioned ##From requester must have one and only one 'post-only' authorization line ('post-only' profile has the id of #1).
2) The fix that I showed above (http://forum.glpi-project.org/viewtopic … 03#p165603) must be done into the GLPi sources for all versions <= 0.90. For GLPi 0.91 it's already done in the core.

- This feature will use the ##From mentioned user for requester at ticket creation, and for follow-up as writer when a email is sent to add a followup.

- Examples: these will match the regex:

##From: Le Forrestier, Martin
##From: L'Homme, Jean-Louis
##From: Test01, Test-01
##From: Carrel, John
##From: Carrel-Lamers, Luke

If you need any more help, please post here: https://github.com/tomolimo/mailanalyzer/issues

Thank you,
Regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#3 2017-05-30 22:13:04

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Create tickets 'On Behalf Of' via emails

tomolimo wrote:

Hello,
This feature has been implemented into the mailanalyzer plugin, here http://plugins.glpi-project.org/#/plugin/mailanalyzer but not documented,
Any received emails which contains in the message body a text that matches the following regex:

/##From: ([_a-z0-9-\' ]+), ([_.a-z0-9- ]+)/i

will be created with requester the person mentioned after the ##From

But it has currently some restrictions:
1) The mentioned ##From requester must have one and only one 'post-only' authorization line ('post-only' profile has the id of #1).
2) The fix that I showed above (http://forum.glpi-project.org/viewtopic … 03#p165603) must be done into the GLPi sources for all versions <= 0.90. For GLPi 0.91 it's already done in the core.

- This feature will use the ##From mentioned user for requester at ticket creation, and for follow-up as writer when a email is sent to add a followup.

- Examples: these will match the regex:

##From: Le Forrestier, Martin
##From: L'Homme, Jean-Louis
##From: Test01, Test-01
##From: Carrel, John
##From: Carrel-Lamers, Luke

If you need any more help, please post here: https://github.com/tomolimo/mailanalyzer/issues

Thank you,
Regards,
Tomolimo

hi Tomolimo,

i would like to know if this resource is working fine on GLPI 9.1.3 and if you have more details about the implementing.
i try to view the documentation on link that you shared, but i can access nothing information.

I appreciate your help.

Thank you so much.

Offline

#4 2017-05-31 08:32:08

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello,
The plugin is compatible with 9.1.2, and to be tested with 9.1.3
Regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#5 2017-07-04 21:58:28

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Create tickets 'On Behalf Of' via emails

tomolimo wrote:

Hello,
The plugin is compatible with 9.1.2, and to be tested with 9.1.3
Regards,
Tomolimo

hi,

I would like to share my experience on 9.1.3.
I could install the Plugin Mail Analyzer    1.3.1, it installed very good, but when i try to Forwarding the message using expression on email Bodyl " ##From: Lastname, FisrtName" , dont working.

Th mailgate collected the e-mail and generate a ticket, but associate the my user like as Requester and not the user listed in the e-mail body.

I would like to know if there additional steps to follow,  besides of "Install the Plugin" and make tests of fwd e-mail.

Reading the topic in the forum, all changes is already done on version over 9.1, correct? or need to change the code also.

Best Regards.

Willian Rocha

Last edited by willianmgrocha (2017-07-04 22:26:15)

Offline

#6 2017-07-24 12:44:31

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello,
Sorry for being late, but was in holidays.
As a matter of fact, there is no more settings to be done, if the format respects the one expected, it should be ok.
Please note also that the requester (the one with behind the ##From) must have one and only one 'post-only' profile.
you may find more info here: https://github.com/tomolimo/mailanalyze … -269440371
regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#7 2017-09-04 21:20:26

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Create tickets 'On Behalf Of' via emails

tomolimo wrote:

Hello,
Sorry for being late, but was in holidays.
As a matter of fact, there is no more settings to be done, if the format respects the one expected, it should be ok.
Please note also that the requester (the one with behind the ##From) must have one and only one 'post-only' profile.
you may find more info here: https://github.com/tomolimo/mailanalyze … -269440371
regards,
Tomolimo

Hi, Tomolimo

Do you know if is possible customize the code for creating tickets "OnBeHalf" independent of profiles be "post-only", "technician", "supervisor" or admin?

i need this request in my environment, because we usual received request by e-mail from our IT Manager and IT supervisors

Thanks for your help.

BEst Regards

Offline

#8 2017-09-05 08:33:20

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello,

In fact the root cause for this is the fact that a ticket must be assigned into an entity, and to get this entity, I use the entity of the 'post-only' profile.
But this doesn't prevent the user to have several profiles, but he needs to have one and only one 'post-only' profile.

So if you need to receive an email from your IT Manager (using the 'OnBehalfOf' feature), then this person needs to have also a 'post-only' profile with the right entity (the one used to create the ticket).

Thank you
Regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#9 2017-09-13 21:57:19

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Create tickets 'On Behalf Of' via emails

tomolimo wrote:

Hello,

In fact the root cause for this is the fact that a ticket must be assigned into an entity, and to get this entity, I use the entity of the 'post-only' profile.
But this doesn't prevent the user to have several profiles, but he needs to have one and only one 'post-only' profile.

So if you need to receive an email from your IT Manager (using the 'OnBehalfOf' feature), then this person needs to have also a 'post-only' profile with the right entity (the one used to create the ticket).

Thank you
Regards,
Tomolimo


Thank you so much for all clarification. It works now! :-)

Offline

#10 2018-09-04 16:37:20

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Create tickets 'On Behalf Of' via emails

tomolimo wrote:

Hello,

In fact the root cause for this is the fact that a ticket must be assigned into an entity, and to get this entity, I use the entity of the 'post-only' profile.
But this doesn't prevent the user to have several profiles, but he needs to have one and only one 'post-only' profile.

So if you need to receive an email from your IT Manager (using the 'OnBehalfOf' feature), then this person needs to have also a 'post-only' profile with the right entity (the one used to create the ticket).

Thank you
Regards,
Tomolimo

Hi, Tomolimo,

I`d like to use the same mechanism "on behalf" feature to auto assign ticket to Technicians responsible, do you know it is possible?

The main idea is Forwarding e-mails using 2 Sintaxes in  the email body, like as the example bellow:

##From: LastName_REquester, FisrtName_Requester
##Assing to: LastName_Technician, FirstName_Technician

Do you think if it is possible?
Do you have any tips for me?

Thanks in advance for your help.

Best Regards

Willian Rocha
GLPI - 9.1.6 on CentoOS 7

Offline

#11 2018-09-04 17:22:21

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello willianmgrocha

The assignment to technician can be done via "Business rules for tickets".

Regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#12 2018-09-06 19:29:42

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Create tickets 'On Behalf Of' via emails

tomolimo wrote:

Hello willianmgrocha

The assignment to a technician can be done via "Business rules for tickets".

Regards,
Tomolimo

Hi Tomolino,

Do you know if there is a regular expression to validate the Technician and Assign to correct responsibly?

Ex; Email Body

##From: Requester_LastName; Requester_FirstName
##Assign to: Technician_Lastname; Technician_FirstName

The tech responsible will be aleatory, for this reason, must be validated and associated based on this criteria.

Thanks in advance for your tips.

Best Regards.

Willian Rocha

Offline

#13 2018-12-16 21:00:19

serano543
Member
Registered: 2018-12-16
Posts: 3

Re: Create tickets 'On Behalf Of' via emails

Hello, but no, it didn't.
It still creates the ticket using the email address from where the ticket was forwarded or created, not using the email address embedded.

We must make this work, otherwise, when you run a report on who sent the tickets, the person with the embedded address won't show up, and in his /her place will show up the ticket creator... which is counterproductive

Offline

#14 2018-12-17 09:05:33

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello serano543,

Could you give GLPI configuration? In Setup > General > System >Information about system installation and configuration
Could you also give PHP error logs if any errors?
Could you also give an exemple of what is not working?

Thank you,
Regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#15 2019-07-19 20:29:27

SilentBob999
Member
Registered: 2019-05-25
Posts: 12

Re: Create tickets 'On Behalf Of' via emails

Hi Tomolimo,
could it be possible to also match the user by email address ?
In large organisation, some duplicate name exist and also some very complicated name combination (some users have two last name in AD but only one in the email address)...
Since it is an email that is receive, it would be easier to copy/paste the sender address and assure it match the right person than trying to figure how to write the name and hope it is unique.

Thank you,
Michel

Offline

#16 2019-07-22 08:29:12

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Create tickets 'On Behalf Of' via emails

Hello SilentBob999,

Actually, this feature is already existing smile
The used pattern is:

/##From\s*:\s*(["']?(?'last'[\w.\-\\' ]+)[, ]\s*(?'first'[\w+.\-\\' ]+))?.*?(?'email'[\w_.+\-]+@[\w\-]+\.[\w\-.]+)?\W*$/imu

Which means that it's possible to match either user's full name, either user's email, like following:

  • ##from: limo, tom "tomolimo@tom.com"

  • ##from: limo, tom <tomolimo@tom.com>

  • ##from: limo, tom 'tomolimo@tom.com'

  • ##from: "tomolimo@tom.com"

  • ##from: tomolimo@tom.com

  • ##from: limo, tom

  • ##from: limo tom

  • and so on...

You may check any syntax using the following site that permits to test regex: https://regex101.com/r/oWbzHy/2

And more over, if an email entry if found in the expression, then it will take precedence over the user's name in the search in the DB.

Thank You
Regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

Board footer

Powered by FluxBB