Hi,
I have a rather unusual problem with some of our user accounts:
I need to merge 2 user accounts into 1 (because - reasons ? ). For example, I have existing users, "User1" and "User2". I want to "reassign" all existing tickets opened by "User1" to "User2", and delete "User1" account afterward. This would effectively merge those 2 accounts into 1 (I hope this makes sense).

I know this can't be done through osTicket's interface and has to be done "manually" in database.
Can somebody please tell me what data in what tables need to be modified to achieve this?

Thank you in advance.

You can do it in the UI, but its a little slow.

Go to Agent Panel -> Users.
Open the User you want to get rid of.
Open each and every ticket they have into a separate tab.
Edit each ticket and change the owner to the other User.
Once you have finished doing this for all tickets, delete the user.

Doing this at the DB level is probably a little faster in bulk... but there is a lot more to be concerned with.

The basics are you need to look in the ost_user table for the old users id, the new users id, and using that look in the ost_user_email. for the new users email.id.

Then you would do something like:
UPDATE ost_ticket SET user_id='17',user_email_id='17' WHERE user_id='11;

Change the first user_id='17' to the new id. (the one you want to keep)
Change the user_email_id='17' is the new email id.
The user_id='11' at the end is the old user id.

Once you've done that you have to decide if you want to muck with the ticket threads. As it stands now you could call it quits and everything will work okay. But if you want the tickets to not look like the threads were all written by someone else then you would need to do something similar for the ost_thread_entry table, ost_thread_event table and probably also the ost_thread_collaborator. You would have to take a good look at them to make sure.

Thank you for your input. I'll definitely try this at the DB level since there are couple of dozen users that need to be merged, and some of them have created up to several hundred tickets. There's no way I'm doing this through the UI. ?

Write a Reply...