Set customer_id to use company tickets

Moderator: crythias

Locked
JDOS
Znuny newbie
Posts: 15
Joined: 15 Sep 2010, 14:28
Znuny Version: 2.4.7
Location: The Netherlands

Set customer_id to use company tickets

Post by JDOS »

Hi all,

I'd like to do this: All our customers need to be able to find each-other's tickets; they all belong to the same company. So, OTRS uses customer_user_id to keep track of the customer (person) whom the ticket belongs to and customer_id is stored with the company name. I used the example in procmail to make sure that requests sent to our servicedesk by email are modified so that the last part of the sender's address is used as customer_id but when a customer uses the webinterface the customer_id is filled with the complete emailaddress. Which is correct ofcourse ([ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var', '', 0 ],). Is it possible to use only company.com is stored as customer_id in the ticket-table of OTRS instead of john.doe@company.com? What field should I map or what expression should I use to accomplish this?

Thanks,
JDOS
OTRS 2.4.9 on openSuSE 11.2 with MySQL database connected to an Active Directory for Agents and Customers.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Set customer_id to use company tickets

Post by crythias »

The customer's customer_id stores with the ticket.
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
JDOS
Znuny newbie
Posts: 15
Joined: 15 Sep 2010, 14:28
Znuny Version: 2.4.7
Location: The Netherlands

Re: Set customer_id to use company tickets

Post by JDOS »

I know but I want the customer_id to get modified from john.doe@company.com to company.com so all the customer's can view each-other's tickets.
OTRS 2.4.9 on openSuSE 11.2 with MySQL database connected to an Active Directory for Agents and Customers.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Set customer_id to use company tickets

Post by crythias »

If the tickets already have the same customer_id, you need to make certain that the Users all have that customer_ID.

For new tickets, you want to be certain that your Users each have that information correctly applied in the Customer ID field. Then you don't necessarily have to mess with the PostmasterFilter about it.

For existing tickets, you can either implement the customer_ids http://doc.otrs.org/2.4/en/html/x1801.h ... mer-ids-db (although if you want everyone to see every ticket in the company, this needs Cartesian methods that get prohibitively tough to manage with >6 users.)

You can check out my dangerous post here to adjust the customer_id for tickets that are already created.
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
JDOS
Znuny newbie
Posts: 15
Joined: 15 Sep 2010, 14:28
Znuny Version: 2.4.7
Location: The Netherlands

Re: Set customer_id to use company tickets

Post by JDOS »

Thanks for your reply crythias.
If the tickets already have the same customer_id, you need to make certain that the Users all have that customer_ID.
Exactly! But how should I do this?
For new tickets, you want to be certain that your Users each have that information correctly applied in the Customer ID field. Then you don't necessarily have to mess with the PostmasterFilter about it.
The example in .procmail does exactly what I need; stripping the user-part from the emailaddress so 'john.doe@company.com' becomes 'company.com' and customer_id in table tickets is filled with 'company.com'. Now I need to know how to "map" 'company.com' to CustomerID in Config.pm so every user get's 'company.com' as CustomerID and Company Tickets in the customer webinterface works as expected.

JDOS
OTRS 2.4.9 on openSuSE 11.2 with MySQL database connected to an Active Directory for Agents and Customers.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Set customer_id to use company tickets

Post by crythias »

Your Active Directory map should do it.
By default, the customerID is mapped to 'mail', but I think (?) it can be mapped to 'domain'? in Config.pm

And once that happens, all new tickets would be mapped to the customer's customer_id if you ignore procmail to do it.

I consider using procmail to define the customer_id *generally* a bad practice because of exactly what you're encountering. If there are no customers that have that customer_id, there is little point to do assign it something that no customer has or will have.

That said, I understand exactly why you did it, (and to a point, you had the right idea) but in my opinion, it's better for database consistency that the customer's information was accurate (as desired) before the ticket was created so the customer's information was correctly applied to new tickets. (Perhaps that isn't for your benefit, but for others who might visit this thread.)
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
JDOS
Znuny newbie
Posts: 15
Joined: 15 Sep 2010, 14:28
Znuny Version: 2.4.7
Location: The Netherlands

Re: Set customer_id to use company tickets

Post by JDOS »

Dear crythias,

Please forgive me my ignorance but I'm not quite into Perl. Suppose, I'd like to test my scenario, what syntax do I have to use? I modified the description of our domain into "company.com"; the string that should be the customer_id for every user and every new ticket created. Do I have to change CustomerID => 'mail' into CustomerID => 'description' or [ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var', '', 0 ] into [ 'UserCustomerID', 'CustomerID', 'description', 0, 1, 'var', '', 0 ] or both? Please, explain to me step-by-step how to implement this.

Thank you for your patience! :?

JDOS
OTRS 2.4.9 on openSuSE 11.2 with MySQL database connected to an Active Directory for Agents and Customers.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Set customer_id to use company tickets

Post by crythias »

Please kindly post your redacted Config.pm in [ code ] [ /code ] tags. Basically, though, if you've already connected OTRS to your active directory setup, you merely have to change the one line that determines the CustomerID.

from http://wiki.otrs.org/index.php?title=Us ... _customers

Code: Select all

       CustomerID => 'mail',
and

Code: Select all

            [ 'UserCustomerID', 'CustomerID',  'mail',            0, 1, 'var', '', 0 ],
I believe that all you'd effectively need to do is change the word "mail" to the field/attribute that holds the information for the domain name|your defined customer_id.
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
JDOS
Znuny newbie
Posts: 15
Joined: 15 Sep 2010, 14:28
Znuny Version: 2.4.7
Location: The Netherlands

Re: Set customer_id to use company tickets

Post by JDOS »

In that case I get the description of the user-object while I need the description of the domain-object. So, first I have to retrieve that information and store this in DomainID:

Code: Select all

# CustomerUser
# (customer user ldap backend and settings)
    $Self->{CustomerUser} = {
        Name => 'LDAP AD Windows 2003',
        Module => 'Kernel::System::CustomerUser::LDAP',
        Params => {
            Host => 'ldap',
            BaseDN => 'DC=company,DC=local',
            SSCOPE => 'one',
            UserDN => 'COMPANY\ldapuser,
            UserPw => 'secret',
            AlwaysFilter => '(objectclass=top)',
            Die => 1,
            Params => {
                port    => 389,
                timeout => 120,
                async   => 0,
                version => 3,
            },
        },
        DomainID => 'description',
 
After this the next part of CustomerUser:

Code: Select all

        Params => {
            Host => 'ldap',
            BaseDN => 'OU=Organization,DC=company,DC=local',
            SSCOPE => 'sub',
            UserDN => COMPANY\ldapuser',
            UserPw => 'secret',
            AlwaysFilter => '(objectclass=user)',
            Die => 1,
            Params => {
                port    => 389,
                timeout => 120,
                async   => 0,
                version => 3,
            },
        },
        CustomerKey => 'sAMAccountName',
        CustomerID => 'mail',
        CustomerUserListFields => ['cn', 'mail'],
        CustomerUserSearchFields => ['cn', 'givenName', 'mail'],
        CustomerUserSearchPrefix => '',
        CustomerUserSearchSuffix => '*',
        CustomerUserPostMasterSearchFields => ['mail'],
        CustomerUserNameFields => ['givenName', 'sn'],
        CustomerUserExcludePrimaryCustomerID => 0,
        CacheTTL => 0,
        Map => [
            [ '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 ],
        ],
    };
Now I need to store the value of DomainID into CustomerID, for every customer. How can I do this?

Please remember, I don't know wether this could be a possible solution for my problem but I really need some explanation how to retrieve the Domain Description, store this value somehow and then assign this to CustomerID, map this to CustomerID, whatever. Or is it somehow possible to strip off the username from the emailaddress and store the domain part to CustomerID within Config.pm, like .procmailrc does?
This is giving me a headache by now ... :(

JDOS
OTRS 2.4.9 on openSuSE 11.2 with MySQL database connected to an Active Directory for Agents and Customers.
JDOS
Znuny newbie
Posts: 15
Joined: 15 Sep 2010, 14:28
Znuny Version: 2.4.7
Location: The Netherlands

Re: Set customer_id to use company tickets

Post by JDOS »

Well, I suppose this solution isn't possible so I changed this:

Code: Select all

 CustomerID => 'physicalDeliveryOfficeName', 
and:

Code: Select all

 [ 'UserCustomerID', 'CustomerID', 'physicalDeliveryOfficeName', 0, 1, 'var', '', 0 ],
In AD I changed Office in the userobjects into company.com and things work as they should. Still, I have the feeling that this is a "clumsy" workaround and there should be a better solution. Anyhow, it works.

JDOS
OTRS 2.4.9 on openSuSE 11.2 with MySQL database connected to an Active Directory for Agents and Customers.
Locked