Auto assign CustomerID when creating new mail ticket

Moderator: crythias

Post Reply
acterios
OTRS newbie
Posts: 4
Joined: 16 Apr 2019, 16:17
OTRS Version?: 6.0.14
Real Name: Matheo Leroy
Company: Groupe LDLC

Auto assign CustomerID when creating new mail ticket

Post by acterios » 24 Apr 2019, 16:52

Hello,

My OTRS setting PostMaster::NewTicket::AutoAssignCustomerIDForUnknownCustomers is currently set to enabled so everyone who sends an email to me gets a customerID if he doesn't already have one.
It happens that I need to send mail to people who haven't created a ticket yet, so I use Create New Email Ticket. The problem is, no CustomerID is auto assigned that way. Is there something I can do about it ?

Thanks :)
OTRS 6.0.14

crythias
Moderator
Posts: 10102
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Auto assign CustomerID when creating new mail ticket

Post by crythias » 03 May 2019, 23:22

OTRS is not intended to be a mass mailer.
To the point of this thread, there is no issue to send an email to a person that does not exist within OTRS. If they reply, they'll do your work for you.
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask

acterios
OTRS newbie
Posts: 4
Joined: 16 Apr 2019, 16:17
OTRS Version?: 6.0.14
Real Name: Matheo Leroy
Company: Groupe LDLC

Re: Auto assign CustomerID when creating new mail ticket

Post by acterios » 07 May 2019, 14:19

Hi Crythias,

Thank you for your answer. It does not seem to work that way - at least I made a configuration mistake. If I send an email to someone who hasn't a CustomerID and this person happen to reply to this email, it doesn't create that CustomerID.
Here is a ticket log from a customer with no CustomerID sends an email :
- Created ticket [201905074165] in "Example Queue" with priority "3 normal" and state "new". (NewTicket)
- Changed service to "NULL" (). (ServiceUpdate)
- Changed SLA to "NULL" (). (SLAUpdate)
- Changed type from "" () to "" (). (TypeUpdate)
- Changed customer to "CustomerID=customer@example.com;CustomerUser=customer@example.com;". (CustomerUpdate)
- Added email. (EmailCustomer)

Here is a ticket log when a customer with no CustomerID answers to an outbound email :
- Changed state from "pending auto close+" to "open". (StateUpdate)
- Changed pending time to "00-00-00 00:00". (SetPendingTime)
- Added follow-up to ticket [201905064168]. (FollowUp)
- Reset of unlock time. (Misc)

If I got your answer right, it shouldn't work that way, woudl you guess what did I do wrong ?

Thank you,
OTRS 6.0.14

crythias
Moderator
Posts: 10102
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Auto assign CustomerID when creating new mail ticket

Post by crythias » 11 May 2019, 06:35

If I send an email to someone who hasn't a CustomerID and this person happen to reply to this email, it doesn't create that CustomerID.
This makes sense. They didn't create a ticket. This is just an add to an existing ticket.
acterios wrote:
24 Apr 2019, 16:52
My OTRS setting PostMaster::NewTicket::AutoAssignCustomerIDForUnknownCustomers is currently set to enabled so everyone who sends an email to me gets a customerID if he doesn't already have one.
It happens that I need to send mail to people who haven't created a ticket yet, so I use Create New Email Ticket. The problem is, no CustomerID is auto assigned that way. Is there something I can do about it ?
I misunderstood this. So you're creating a new email ticket (not just an email) for someone who doesn't exist in your system and you want that user to be created as you create the the ticket?

I'm not familiar with this being possible. Sure, you can manually populate the information for Customer_ID with the email address manually, but I'm not sure if this is possible to have OTRS generate one while an agent creates the ticket for a new customer. It certainly would be better to create the customer first.

If you have many such customers, you may choose to populate your customer_user database via command line.
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask

acterios
OTRS newbie
Posts: 4
Joined: 16 Apr 2019, 16:17
OTRS Version?: 6.0.14
Real Name: Matheo Leroy
Company: Groupe LDLC

[SOLVED] Auto assign CustomerID when creating new mail ticket

Post by acterios » 14 May 2019, 10:00

I misunderstood this. So you're creating a new email ticket (not just an email) for someone who doesn't exist in your system and you want that user to be created as you create the the ticket?
Yes, I wasn't very clear about that but that's the point. Unfortunately, I don't have full access to my OTRS setup, I'll try to find another way to do this.

Thanks for your answers, have a nice day :)
OTRS 6.0.14

cdhowie
OTRS newbie
Posts: 1
Joined: 04 Jun 2019, 19:54
OTRS Version?: 6.0.12
Real Name: Chris Howie

Re: Auto assign CustomerID when creating new mail ticket

Post by cdhowie » 04 Jun 2019, 23:49

We ran into the same problem (it's a shame that there isn't an option to enable this behavior properly) but we have a simple fix. We run the following SQL query against the database on a regular basis. (It could also be integrated into a generic agent that is triggered by Ticket::TicketCreate.)

Replace DOMAIN with your system's mail domain.

Code: Select all

update ticket

inner join (
        select id, (
                select a_to
                from article
                inner join article_data_mime on article_data_mime.article_id = article.id
                where article.ticket_id = ticket.id
                order by article.id asc
                limit 1
        ) as cid
        from ticket
        where (customer_id is null or customer_id = '') and
                (customer_user_id is null or customer_user_id = '') and
                (
                        select a_from like '%@DOMAIN>'
                        from article
                        inner join article_data_mime on article_data_mime.article_id = article.id
                        where article.ticket_id = ticket.id
                        order by article.id asc
                        limit 1
                )
) x on ticket.id = x.id

set ticket.customer_id = x.cid,
        ticket.customer_user_id = x.cid
OTRS 6.0.12 | Linux | MariaDB

acterios
OTRS newbie
Posts: 4
Joined: 16 Apr 2019, 16:17
OTRS Version?: 6.0.14
Real Name: Matheo Leroy
Company: Groupe LDLC

[SOLVED] Auto assign CustomerID when creating new mail ticket

Post by acterios » 21 Jun 2019, 14:39

Hi cdhowie,

Thanks, it worked !
If anyone wants to try this, don't forget to empty the "query limit" field, if not OTRS throws an error message.

Have a nice day,
OTRS 6.0.14

Post Reply