Create customer automatically from ticket

Moderator: crythias

Locked
it4change
Znuny newbie
Posts: 13
Joined: 11 Dec 2010, 23:39
Znuny Version: 3.0.3

Create customer automatically from ticket

Post by it4change »

Is it possible to automatically create a customer from ticket?
When handling a ticket it would be nice to have a button "add customer"
A customer entry is added and it should be possible to update company info, phone etc.

Anyone got a solution to this?

Thanks
Testing: OTRS 3.0.5
OS: 2003 server
Mothra
Znuny expert
Posts: 189
Joined: 26 Oct 2010, 15:04
Znuny Version: 3.2.11

Re: Create customer automatically from ticket

Post by Mothra »

I've been thinking about this lately: the main problem is satisfying all of the required fields to create both a Company and Customer, using the only information you have, which is an email address.

Create a company
CustomerID: the domain part of the email address
Company: the domain part of the email address

Create a Customer
Firstname/Lastname, split the first part of the email address on period/underscore or, if not possible, simply repeat the whole thing in each field (e.g. Firstname = joewilson, Lastname = joewilson... even though the guy's real name is Joe Wilson)
Username - the entire email address
Email- the entire email address
CustomerID - same as one used to create the Company

Another problem is that you may already have companies in there for which the CustomerID is not the domain part of the email. My only suggestion for this is to adopt this practice retrospectively in your system if you can.

I haven't got a fully working solution to just hand over to you*, but it occurred to me while reading this: http://forums.otrs.org/viewtopic.php?f=60&t=6586 that it should actually be possible by modifying the same bit of code to add the Company and Customer. You'll want to wrap the bit where you create a new Company inside a check to make sure the Company doesn't already exist.

* My current contract as an OTRS Consultant runs out at the end of this month, so unless my next contract is also OTRS-related work (and it's very unlikely as OTRS is almost unheard of here in the UK), I probably won't get to realise a fully working solution unless I manage to do it in what's left of my spare time.
OTRS 3.2.11 on Centos 6.4 with MySQL 5.0. Agents and internal customers authenticate via Active Directory.
it4change
Znuny newbie
Posts: 13
Joined: 11 Dec 2010, 23:39
Znuny Version: 3.0.3

Re: Create customer automatically from ticket

Post by it4change »

Thanks, it's great to get other peoples thoughts on a problem.
Thanks for your time and thanks for the code snippet.
Testing: OTRS 3.0.5
OS: 2003 server
Locked