Customer information not filled with mail sent

Moderator: crythias

Locked
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Customer information not filled with mail sent

Post by robcar »

Hello,

I'm configuring my first OTRS server.
I got A.D. LDAP integration, which seems to be working fine.
Whenever customer logs in via web interface and opens a ticket I see, in the agent interface, Customer Information.
But whenever she sends a mail there's no Customer Info, even if the CustomerID is the same (mail address).
In the agent i/f I can see all tickets opened by the customer (via web i/f and via mail); but in the customer i/f she only sees the tickets that she opened via the web i/f, not that she sent via mail.

So to sum things up my questions are two:
1) how can I have Customer Information filled when tickets are generated by mails
2) how can customers see also tickets that they opened via mail

Thank you

--
rob
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer information not filled with mail sent

Post by crythias »

robcar wrote:if the CustomerID is the same (mail address).
That's not the criteria. The email address of the user must be in the customer information in the email box. It doesn't matter if it's also in the CustomerID box.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

crythias wrote:
robcar wrote:if the CustomerID is the same (mail address).
That's not the criteria. The email address of the user must be in the customer information in the email box. It doesn't matter if it's also in the CustomerID box.
Thanks for the reply, but I still don't understand if it is possible to achieve what I wanted:

1) how can I have Customer Information filled when tickets are generated by mails
2) how can customers see in customer.pl site also the tickets that they opened via mail

An extract of My Config.pm:

Code: Select all

      ...
      CustomerKey => 'sAMAccountName',
      CustomerID => 'mail',
      CustomerUserListFields => ['sAMAccountName', 'sn', 'givenname', 'company',  'mail'],
      CustomerUserSearchFields => ['sAMAccountName', 'sn', 'givenname', 'company', 'mail'],
      CustomerUserPostMasterSearchFields => ['mail'],
      CustomerUserNameFields => ['givenname', 'sn'],
      CustomerUserValidFilter => '(company=*)',
      Map => [
        [ 'UserSalutation', 'Title', 'title', 1, 0, 'var' ],
        [ 'UserFirstname', 'Firstname', 'givenname', 1, 1, 'var' ],
        [ 'UserLastname', 'Lastname', 'sn', 1, 1, 'var' ],
        [ 'UserLogin', 'Login', 'sAMAccountName', 1, 1, 'var' ],
        [ 'UserEmail', 'Email', 'mail', 1, 1, 'var' ],
        [ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var' ],
        [ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var' ],
        [ 'UserAddress', 'Address', 'postaladdress', 1, 0, 'var' ],
        [ 'UserComment', 'Comment', 'description', 1, 0, 'var' ],
      ],
      ...
thank you

--
rob
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

Sorry for the re-post but does anybody know how can I efficiently integrate tickets opened via mail?
1) how can I have Customer Information filled when tickets are generated by mails
Do I have to use PostMaster Filters? How?
2) how can customers see in customer.pl site also the tickets that they opened via mail
No clue...

--
rob
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer information not filled with mail sent

Post by crythias »

robcar wrote:1) how can I have Customer Information filled when tickets are generated by mails
a) You can't create customer information out of an email sent to your environment
b) If the information already exists in OTRS, it will match if the email address of sender matches the email field of the user
robcar wrote:2) how can customers see in customer.pl site also the tickets that they opened via mail
They will see tickets in My Tickets if their login to the customer.pl matches the login (customer_user_id) assigned to the ticket, which would populate if the customer exists in OTRS and the sent email from address matched an existing user that OTRS knows about. If the email is not connected to a known user, there is no general login appropriate for the ticket, and the end user won't match, won't see it.

They will see tickets in Company Tickets where the customer_id matches the current logged-in user's customer_id or is in the customer_ids field of the currently logged in customer.

Also, the ticket must be in a queue that resides in a group the currently logged in customer has access to, if Customer Group Support is enabled.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
EXG133
Znuny expert
Posts: 217
Joined: 06 Aug 2012, 18:12
Znuny Version: 3.1.7 & 4.04

Re: Customer information not filled with mail sent

Post by EXG133 »

If you want to user your AD users as customer you need to use "$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';" and define the proper backend settings.
Can you show the complete $Self->'Customer:: stuff with your credentials etc filtered out?
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

EXG133 wrote:If you want to user your AD users as customer you need to use "$Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';" and define the proper backend settings.
Thanks for replying and sorry for my delay; yep, I do have those settings and AD auth works fine.
EXG133 wrote:Can you show the complete $Self->'Customer:: stuff with your credentials etc filtered out?
Don't get this one, can you please further explain? Thanks.
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

Thanks for the prompt reply and sorry for my delay.
crythias wrote: a) You can't create customer information out of an email sent to your environment
Ok, got it.
crythias wrote: b) If the information already exists in OTRS, it will match if the email address of sender matches the email field of the user
Well, information doesn't already exist in OTRS, because I'm using an external LDAP backend, right? BUT CustomerID is the same (mail address) and indeed if I click onto the mail in the Ticket Information the system recognizes that it is the same customer and shows both tickets opened via web interface and tickets sent by the customer by mail under Customer Information Center. So the system knows how to match those pieces of info, but the same mechanism is not used when getting customer info in Customer Information box for a ticket.
crythias wrote: They will see tickets in My Tickets if their login to the customer.pl matches the login (customer_user_id) assigned to the ticket, which would populate if the customer exists in OTRS and the sent email from address matched an existing user that OTRS knows about. If the email is not connected to a known user, there is no general login appropriate for the ticket, and the end user won't match, won't see it.
Same here I guess. Customers don't really exist in OTRS, if you are talking about internal OTRS customer users.
crythias wrote: They will see tickets in Company Tickets where the customer_id matches the current logged-in user's customer_id or is in the customer_ids field of the currently logged in customer.

Also, the ticket must be in a queue that resides in a group the currently logged in customer has access to, if Customer Group Support is enabled.
Ok, haven't already tried Company tickets.
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer information not filled with mail sent

Post by crythias »

robcar wrote:Well, information doesn't already exist in OTRS, because I'm using an external LDAP backend, right?
I don't know. If you've properly configured it as a customer backend, OTRS thinks it knows where to query the data, so it's "in" OTRS inasmuch as OTRS knows where to look for matching fields to attributes from the CustomerUser Map.
robcar wrote:BUT CustomerID is the same (mail address) and indeed if I click onto the mail in the Ticket Information the system recognizes that it is the same customer and shows both tickets opened via web interface and tickets sent by the customer by mail under Customer Information Center.
Fair, but this is not CustomerUserID (login), but CustomerID (essentially, department or Company). That its value is an email address by default doesn't exactly mean anything more than email address is used as a placeholder value for CustomerID.

viewtopic.php?f=60&t=7531 (More about CustomerID)
viewtopic.php?f=60&t=16543 (More about LDAP Troubleshooting)
robcar wrote:Customers don't really exist in OTRS, if you are talking about internal OTRS customer users.
Well, like I said, if OTRS knows of them, they exist, no matter if they're DB or LDAP.
This might be of interest:

Code: Select all

        [ 'UserLogin',      'Username',   'sAMAccountName',             1, 1, 'var', '', 0 ],
         [ 'UserEmail',      'Email',      'mail',            1, 1, 'var', '', 0 ],
        [ 'UserCustomerID', 'CustomerID', 'mail',            0, 1, 'var', '', 0 ],
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

crythias wrote: viewtopic.php?f=60&t=7531 (More about CustomerID)
viewtopic.php?f=60&t=16543 (More about LDAP Troubleshooting)
Thanks for sharing, I'll for sure have a look at those threads.
crythias wrote: Well, like I said, if OTRS knows of them, they exist, no matter if they're DB or LDAP.
This might be of interest:

Code: Select all

        [ 'UserLogin',      'Username',   'sAMAccountName',             1, 1, 'var', '', 0 ],
         [ 'UserEmail',      'Email',      'mail',            1, 1, 'var', '', 0 ],
        [ 'UserCustomerID', 'CustomerID', 'mail',            0, 1, 'var', '', 0 ],
Seems like mine, apart from the trailing '', 0; I'll expand my config, just in case you spot something wrong :D

Code: Select all

      
      ...
      CustomerKey => 'sAMAccountName',
      CustomerID => 'mail',
      CustomerUserListFields => ['sAMAccountName', 'sn', 'givenname', 'company',  'mail'],
      CustomerUserSearchFields => ['sAMAccountName', 'sn', 'givenname', 'company', 'mail'],
      CustomerUserPostMasterSearchFields => ['mail'],
      CustomerUserNameFields => ['givenname', 'sn'],
      CustomerUserValidFilter => '(company=*)',
      Map => [
        [ 'UserSalutation', 'Title', 'title', 1, 0, 'var' ],
        [ 'UserFirstname', 'Firstname', 'givenname', 1, 1, 'var' ],
        [ 'UserLastname', 'Lastname', 'sn', 1, 1, 'var' ],
        [ 'UserLogin', 'Login', 'sAMAccountName', 1, 1, 'var' ],
        [ 'UserEmail', 'Email', 'mail', 1, 1, 'var' ],
        [ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var' ],
        [ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var' ],
        [ 'UserAddress', 'Address', 'postaladdress', 1, 0, 'var' ],
        [ 'UserComment', 'Comment', 'description', 1, 0, 'var' ],
      ],
      ...
thanks for your time
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled when mail sent

Post by robcar »

crythias wrote: They will see tickets in Company Tickets where the customer_id matches the current logged-in user's customer_id or is in the customer_ids field of the currently logged in customer.
Hey, hey, hey!
As you said under Company Tickets the customer sees ALL tickets, both opened via web interface and via mail! :D
I'll have to read carefully the howto you posted before.
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer information not filled with mail sent

Post by crythias »

robcar wrote:As you said under Company Tickets the customer sees ALL tickets, both opened via web interface and via mail!
Yes, but the real question is why do mail tickets not have sAMAccountName as login... or what is the login username associated with the mail ticket and why does it not match your customer's login?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled when mail sent

Post by robcar »

crythias wrote:Yes, but the real question is why do mail tickets not have sAMAccountName as login... or what is the login username associated with the mail ticket and why does it not match your customer's login?
I read you howto, looked into the database and that's what I found out.

Code: Select all

mysql> select customer_id,customer_user_id from ticket;
+---------------------------------+--------------------------------------+
| customer_id                     | customer_user_id                     |
+---------------------------------+--------------------------------------+
| j.smith@example.com             | SmithJ                               |
| j.smith@example.com             | j.smith@example.com                  |
The first row corresponds to a web ticket; the second row is a mail ticket, by the same user.
So I guess that in my config I can change customer_user_id to match email address other than sAMAccountName, what do you think?

Maybe, but I'm just guessing, I could change this one:

Code: Select all

     # customer unique id
      CustomerKey => 'sAMAccountName',
to this one?

Code: Select all

     # customer unique id
      CustomerKey => 'mail',
In my case there is always one-to-one correspondence between mail and user.
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled when mail sent

Post by robcar »

robcar wrote:

Code: Select all

     # customer unique id
      CustomerKey => 'mail',
Nope, of course it doesn't work, it doesn't let me authenticate to the customer web interface...
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

crythias wrote: a) You can't create customer information out of an email sent to your environment
I'm back to this point; ok, I can't create customer info out of an email, but that's what OTRS scripts are doing, right?
When a mail ticket is picked up OTRS has to pull customer info and create a new ticket.

With no knowledge of Perl I tried to have a look at the source code and I guess that this task is done by the Kernel/System/PostMaster/NewTicket.pm script.
At some point I understand it is extracting info from custom mail headers:

Code: Select all

# get customer id (sender email) if there is no customer id given
    if ( !$GetParam{'X-OTRS-CustomerNo'} && $GetParam{'X-OTRS-CustomerUser'} )
In the doc I see that:
X-OTRS-CustomerUser: CustomerUser
X-OTRS-CustomerNo: CustomerNo
So first question:
1)
X-OTRS-CustomerUser = CustomerUser = customer_user_id in the db (login)?
and
X-OTRS-CustomerNo = CustomerNo = customer_id in the db (company id)?

Assuming it is so at some point if it can't get X-OTRS-CustomerUser (customer_user_id):

Code: Select all

# get customer user data form From: (sender address)
    if ( !$GetParam{'X-OTRS-CustomerUser'} ) {
it tries someway :) to obtain CustomerUser and CustomerNo. I'm not pasting the entire code here, even it's not very long.
I can see "# take CustomerID from customer backend lookup or from from field" in the comments.

So second question:
2)
If someone with some Perl expertise could have a look at the above snippet could he explain to me in which way the code is connecting to customer backend and getting customer info? With that knowledge maybe I could fix my Config.pm LDAP settings in oder to get correct customer_user_id/login.

And then I understand that if falls back to mail address for both CustomerNo and CustomerUser, which is exactly what is happening to the Ticket table when a mail ticket is received:

Code: Select all

# if there is no customer id found!
    if ( !$GetParam{'X-OTRS-CustomerNo'} ) {
        $GetParam{'X-OTRS-CustomerNo'} = $GetParam{SenderEmailAddress};
    }

    # if there is no customer user found!
    if ( !$GetParam{'X-OTRS-CustomerUser'} ) {
        $GetParam{'X-OTRS-CustomerUser'} = $GetParam{SenderEmailAddress};
    }
Does it make sense?
Thanks
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer information not filled with mail sent

Post by crythias »

1) yes. Note that X-OTRS-x refers to potential headers in the email
2) https://github.com/OTRS/otrs/blob/maste ... et.pm#L137
Does the header provide info? No, so get the From / Sender email and look it up (CustomerSearch /155) from that result, get Customer User data / 160.

http://github.com/otrs/otrs/blob/master ... er.pm#l160 is Customer Search.
Basically it runs through available backends to gather data.
At which point,I'm thinking that your backend is probably never seen.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

crythias wrote: At which point,I'm thinking that your backend is probably never seen.
Thanks.
Yes, maybe my A.D. backend is not seen, but only with mail tickets, because customer web interface works fine.
Browsing A.D. users when creating New Phone/Mail Ticket works wonderfully too, with customer_user_id filled with sAMAccountname and not mail address.
Don't know...
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer information not filled with mail sent

Post by crythias »

May I see your config.pm?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
robcar
Znuny newbie
Posts: 40
Joined: 23 Oct 2015, 15:41
Znuny Version: 5.0.3
Real Name: Roberto Carraro
Company: FAIV

Re: Customer information not filled with mail sent

Post by robcar »

Here you are! :)

Code: Select all

    # Enable LDAP lookups for Customer logins.
    $Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';
    $Self->{'Customer::AuthModule::LDAP::Host'} = 'dc01.example.dom';
    $Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'dc=example,dc=dom';
    $Self->{'Customer::AuthModule::LDAP::UID'} = 'sAMAccountName';
    $Self->{'Customer::AuthModule::LDAP::SearchUserDN'} = 'cn=otrs-ad-connector-user,cn=Users,dc=example,dc=dom';
    $Self->{'Customer::AuthModule::LDAP::SearchUserPw'} = 'password';
    $Self->{'Customer::AuthModule::LDAP::AlwaysFilter'} = '(objectclass=user)';
    $Self->{'Customer::AuthModule::LDAP::GroupDN'} = 'CN=otrs_customers,OU=xxx,OU=yyy,DC=example,DC=dom';
    $Self->{'Customer::AuthModule::LDAP::AccessAttr'} = 'member';
    $Self->{'Customer::AuthModule::LDAP::UserAttr'} = 'DN';

    # Enable LDAP lookups for Customer account information.
    $Self->{CustomerUser} = {
      Module => 'Kernel::System::CustomerUser::LDAP',
      Params => {
        Host => 'dc01.example.dom',
        BaseDN => 'dc=example,dc=dom',
        SSCOPE => 'sub',
        UserDN => 'cn=otrs-ad-connector-user,cn=Users,dc=example,dc=dom',
        UserPw => 'password',
        AlwaysFilter => '(objectclass=user)',
#        GroupDN => 'CN=otrs_customers,OU=xxx,OU=yyy,DC=example,DC=dom',
#        AccessAttr => 'member',
#        UserAttr => 'DN',
      },

     # customer unique id
      CustomerKey => 'sAMAccountName',
      # customer #
      CustomerID => 'mail',
      CustomerUserListFields => ['sAMAccountName', 'cn', 'mail'],
      CustomerUserSearchFields => ['sAMAccountName', 'cn', 'mail'],
      CustomerUserSearchPrefix => '',
      CustomerUserSearchSuffix => '*',
      CustomerUserSearchListLimit => 1000,
      CustomerUserPostMasterSearchFields => ['mail'],
      CustomerUserNameFields => ['givenname', 'sn'],
      # show not own tickets in customer panel, CompanyTickets
      CustomerUserExcludePrimaryCustomerID => 0,
      # add an ldap filter for valid users (expert setting)
   #    CustomerUserValidFilter => '(!(description=locked))',
      # administrator can't change customer preferences
      AdminSetPreferences => 0,
   #    # cache time to live in sec. - cache any database queries
   #    CacheTTL => 0,
      Map => [
         # note: Login, Email and CustomerID are mandatory!
         # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
         [ 'UserTitle',      'Title',      'title',           1, 0, 'var', '', 0 ],
         [ 'UserFirstname',  'Firstname',  'givenname',       1, 1, 'var', '', 0 ],
         [ 'UserLastname',   'Lastname',   'sn',              1, 1, 'var', '', 0 ],
         [ 'UserLogin',      'Username',   'sAMAccountName',             1, 1, 'var', '', 0 ],
         [ 'UserEmail',      'Email',      'mail',            1, 1, 'var', '', 0 ],
         [ 'UserCustomerID', 'CustomerID', 'mail',            0, 1, 'var', '', 0 ],
   #       [ 'UserCustomerIDs', 'CustomerIDs', 'second_customer_ids', 1, 0, 'var', '', 0 ],
         [ 'UserPhone',      'Phone',      'telephonenumber', 1, 0, 'var', '', 0 ],
         [ 'UserAddress',    'Address',    'postaladdress',   1, 0, 'var', '', 0 ],
         [ 'UserComment',    'Comment',    'description',     1, 0, 'var', '', 0 ],
      ],
   },
OTRS 5 on Linux with MySQL and LDAP A.D. backend.
Locked