Mass Ticket Import with timestamping

Moderator: crythias

Post Reply
massimobianchi
Znuny newbie
Posts: 67
Joined: 02 Apr 2012, 12:18
Znuny Version: 3.1.14
Real Name: Massimo Bianchi
Company: NPO Sistemi S.p.A.
Contact:

Mass Ticket Import with timestamping

Post by massimobianchi »

Hi,
I have the following necessisty, to do a mass import of tickets from a previous database.

I have already managed to setup a decent procedure:
- export in CSV format from the other product
- building of custom DynamicField to keep the additional information
- script to extract records from CSV and build many, many emails, to be loaded into OTRS using ./otrs.PostMaster.pl

Questions:
1- is there any more clever approach to obtain the same results ?
2- I want to maintain the original timestamp.... I know that I can modify the attributes directly into the database, BUT I would prefer to avoid it. any suggestion ?

Kind regards,
Massimo
Massimo Bianchi
skype: massimo.bianchi
OTRS:3.1.14, ITSM:3.1.8, httpd, mysql, Centos 6.3 on X86_64
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: Mass Ticket Import with timestamping

Post by ferrosti »

I won´t go for an import using the PostMaster script. This is due the matter that each article from the old system would be handled like an external mail.
It would be more efficient to write an own perl import program using OTRSs API, which is well documented. One would only have to take care of the differences of tickets and articles.
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Mass Ticket Import with timestamping

Post by crythias »

You cannot use the API as written *AND* keep the timestamp, as timestamp is *now* all the time.
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
massimobianchi
Znuny newbie
Posts: 67
Joined: 02 Apr 2012, 12:18
Znuny Version: 3.1.14
Real Name: Massimo Bianchi
Company: NPO Sistemi S.p.A.
Contact:

Re: Mass Ticket Import with timestamping

Post by massimobianchi »

To whom it maight interest...

I went to the email script, adding a tag inside the body of the email to retain the original timestamp.

Not a very good alternative, but I'm not a programmer, just occasionally a scripter... on *nix systems.

Code: Select all

#!/bin/bash
#
# input richiesti, in questo ordine
#
# CODGTCRM , TITOLOGTCRM , CATEGORIA, TIPO,  SLA , RIFCLIENTE , DATACREAZIONE , BODY
#

INPUT=ticket.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read CODGTCRM TITOLOGTCRM CATEGORIA TIPO SLA RIFCLIENTE DATACREAZIONE BODY
do
        UNIVOCO=$(shuf -e $(date +%N))
        {
        echo "From test.npo@XXXX.mi.it Thu May 31 18:00:00 CEST 2012"
        echo "Return-Path: < test.npo@XXXX.mi.it>"
        echo "Received: (from skywalker@localhost)"
        echo "  by avro.de (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) id "  $UNIVOCO
        echo "  for martin@localhost;Thu May 31 17:16:43 CEST 2012"
        echo "Date: 31/05/2012 18:00"
        echo "From: AutomaticTicketImport <test.npo@XXXX.mi.it>"
        echo "To: supporto.fom@XXXX.it"
        echo "Subject: " $CODGTCRM " " $TITOLOGTCRM
        echo "Message-ID: " $UNIVOCO "@auto.XXXX.it"
        echo "Mime-Version: 1.0"
        echo "Content-Type: text/plain; charset=us-ascii"
        echo "Content-Disposition: inline"
        echo "X-Operating-System: Linux 2.4.10-4GB i686"
        echo "X-Otrs-Customerno: FOX"
        echo "X-Otrs-Customeruser: Supporto.Fom@XXXX.it"
        echo "X-OTRS-DynamicField-ExtTicketInbound:" $CODGTCRM
        echo "X-Otrs-Priority: 3 normal"
        echo "X-OTRS-Queue:   que_fox"
        echo "X-Otrs-Type: " $TIPO
        echo "X-OTRS-SLA: " $SLA
        echo "X-OTRS-Service: " $CATEGORIA
        echo "$BODY"

        echo "-------------------------------------"
        echo "DATA_APERTURA: " $DATACREAZIONE
        echo "RIF_CLIENTE: " $RIFCLIENTE
        echo "-------------------------------------"
        echo "Ticket generato per import automatico"
        } > $UNIVOCO.mbox
done < $INPUT
IFS=$OLDIFS
Massimo Bianchi
skype: massimo.bianchi
OTRS:3.1.14, ITSM:3.1.8, httpd, mysql, Centos 6.3 on X86_64
Post Reply