freefield autofill

Hi all, Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a mysql trigger or something else that parse incoming mail (so insert into) and take values and update the same record ? thanks in advance. MV

Sorry, I don't understand the request. Are you wanting to parse the incoming message and then set FreeText fields accordingly? From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Marco Vannini Sent: Saturday, 21 November 2009 2:43 AM To: User questions and discussions about OTRS. Subject: [otrs] freefield autofill Hi all, Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a mysql trigger or something else that parse incoming mail (so insert into) and take values and update the same record ? thanks in advance. MV

yes, it should be something like this.
ie, this is the incoming mail
from: ConfigurationManager
to: deployment, otrs
Subject: REV-EBIS version REV-EBIS_209.0.6.B1_IT Available for Test
Environment
Body:
Availability in System Test environment.
Release REV-EBIS version REV-EBIS_209.0.6.B1_IT available for System Test
environment on the Italian StarTeam server
Project: Business_Intelligence
View: REV-EBIS_209.0.6.B1_IT
CR implemented: n.a.
Bug Solved: 75948;76004
for the last two row I would like to get (for CR) n.a (or the values that
could be present) and (for Bug Solved) 75948;76004 and populate freetext7
and freetext8 respectively.
On Sun, Nov 22, 2009 at 11:25 PM, James Morgan
Sorry, I don’t understand the request. Are you wanting to parse the incoming message and then set FreeText fields accordingly?
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Saturday, 21 November 2009 2:43 AM *To:* User questions and discussions about OTRS. *Subject:* [otrs] freefield autofill
Hi all,
Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a mysql trigger or something else that parse incoming mail (so insert into) and take values and update the same record ?
thanks in advance.
MV
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/

I did something similar to this with RT and OTRS. There's a department
here that uses RT and we use OTRS, so I wrote a script that can accept
the piped output from sendmail (as an alias), parse the message subject
(which had the RT number in it) and add the RT number to one of the
FreeText fields. It also did a MySQL lookup on the ticket table to work
out which ticket number in OTRS was correct for that RT number and then
modified the subject line of the message to suit (added [Ticket#...]
because RT strips it out).
I suggest it might be a decent option for you.
From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of
Marco Vannini
Sent: Monday, 23 November 2009 9:36 AM
To: User questions and discussions about OTRS.
Subject: Re: [otrs] freefield autofill
yes, it should be something like this.
ie, this is the incoming mail
from: ConfigurationManager
to: deployment, otrs
Subject: REV-EBIS version REV-EBIS_209.0.6.B1_IT Available for Test
Environment
Body:
Availability in System Test environment.
Release REV-EBIS version REV-EBIS_209.0.6.B1_IT available for System
Test environment on the Italian StarTeam server
Project: Business_Intelligence
View: REV-EBIS_209.0.6.B1_IT
CR implemented: n.a.
Bug Solved: 75948;76004
for the last two row I would like to get (for CR) n.a (or the values
that could be present) and (for Bug Solved) 75948;76004 and populate
freetext7 and freetext8 respectively.
On Sun, Nov 22, 2009 at 11:25 PM, James Morgan

Yes it might be, I thought that a trigger could be faster end easiest and
would not impact the normal and clean flow that PostMasterMailbox
implements. I was thinking at a script that could be executed by the
GenericAgent too but I cannot see how having just ARG[0] and ARG[1] that I
think they are not enougth for my job. So, probably I'll go through a
fetchmail/procmail solution that I think it's similar to what you told me.
Thank you very mutch.
cheers.
MV
On Sun, Nov 22, 2009 at 11:54 PM, James Morgan
I did something similar to this with RT and OTRS. There’s a department here that uses RT and we use OTRS, so I wrote a script that can accept the piped output from sendmail (as an alias), parse the message subject (which had the RT number in it) and add the RT number to one of the FreeText fields. It also did a MySQL lookup on the ticket table to work out which ticket number in OTRS was correct for that RT number and then modified the subject line of the message to suit (added [Ticket#...] because RT strips it out).
I suggest it might be a decent option for you.
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Monday, 23 November 2009 9:36 AM
*To:* User questions and discussions about OTRS. *Subject:* Re: [otrs] freefield autofill
yes, it should be something like this.
ie, this is the incoming mail
from: ConfigurationManager
to: deployment, otrs
Subject: REV-EBIS version REV-EBIS_209.0.6.B1_IT Available for Test Environment
Body:
Availability in System Test environment.
Release REV-EBIS version REV-EBIS_209.0.6.B1_IT available for System Test environment on the Italian StarTeam server
Project: Business_Intelligence
View: REV-EBIS_209.0.6.B1_IT
CR implemented: n.a.
Bug Solved: 75948;76004
for the last two row I would like to get (for CR) n.a (or the values that could be present) and (for Bug Solved) 75948;76004 and populate freetext7 and freetext8 respectively.
On Sun, Nov 22, 2009 at 11:25 PM, James Morgan
wrote: Sorry, I don’t understand the request. Are you wanting to parse the incoming message and then set FreeText fields accordingly?
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Saturday, 21 November 2009 2:43 AM *To:* User questions and discussions about OTRS. *Subject:* [otrs] freefield autofill
Hi all,
Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a mysql trigger or something else that parse incoming mail (so insert into) and take values and update the same record ?
thanks in advance.
MV
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/

I've to rectify myself... CMD space in GenericAgent is more then enough for
me because this mail goes to a generic queue and I just have to classify
them. so, with the same criteria used in GA I can execute a script where it
takes ticket_id (ARG[1]) and goes in article table with a batch select, it
parse what I need and then, with the same ticket_id I make an update...
So simple ... I'm so lazy...I'm going to try this.
ciao,
MV
On Mon, Nov 23, 2009 at 12:43 AM, Marco Vannini
Yes it might be, I thought that a trigger could be faster end easiest and would not impact the normal and clean flow that PostMasterMailbox implements. I was thinking at a script that could be executed by the GenericAgent too but I cannot see how having just ARG[0] and ARG[1] that I think they are not enougth for my job. So, probably I'll go through a fetchmail/procmail solution that I think it's similar to what you told me.
Thank you very mutch.
cheers.
MV
On Sun, Nov 22, 2009 at 11:54 PM, James Morgan
wrote:
I did something similar to this with RT and OTRS. There’s a department here that uses RT and we use OTRS, so I wrote a script that can accept the piped output from sendmail (as an alias), parse the message subject (which had the RT number in it) and add the RT number to one of the FreeText fields. It also did a MySQL lookup on the ticket table to work out which ticket number in OTRS was correct for that RT number and then modified the subject line of the message to suit (added [Ticket#...] because RT strips it out).
I suggest it might be a decent option for you.
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Monday, 23 November 2009 9:36 AM
*To:* User questions and discussions about OTRS. *Subject:* Re: [otrs] freefield autofill
yes, it should be something like this.
ie, this is the incoming mail
from: ConfigurationManager
to: deployment, otrs
Subject: REV-EBIS version REV-EBIS_209.0.6.B1_IT Available for Test Environment
Body:
Availability in System Test environment.
Release REV-EBIS version REV-EBIS_209.0.6.B1_IT available for System Test environment on the Italian StarTeam server
Project: Business_Intelligence
View: REV-EBIS_209.0.6.B1_IT
CR implemented: n.a.
Bug Solved: 75948;76004
for the last two row I would like to get (for CR) n.a (or the values that could be present) and (for Bug Solved) 75948;76004 and populate freetext7 and freetext8 respectively.
On Sun, Nov 22, 2009 at 11:25 PM, James Morgan < james.morgan@vernet.net.au> wrote:
Sorry, I don’t understand the request. Are you wanting to parse the incoming message and then set FreeText fields accordingly?
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Saturday, 21 November 2009 2:43 AM *To:* User questions and discussions about OTRS. *Subject:* [otrs] freefield autofill
Hi all,
Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a mysql trigger or something else that parse incoming mail (so insert into) and take values and update the same record ?
thanks in advance.
MV
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/

Here attached the quick and dirty script that I've implemented... obviously
it lacks on security, file & disk usage, performance, syntax and comments
(and anything else ... :D ) but it is a skel to start with for anyone
interested:
[otrs@otrsbox:/opt/otrs/bin]# cat crbugfix.sh
#!/bin/bash
TICKETNUMBER=$1
TICKETID=$2
. /etc/profile
#echo $1 $2 > /tmp/arguments
mysql -r --user=otrs --password=xxxx otrs <<EOF > /tmp/tempo
select a_body from article where ticket_id = ${TICKETID};
EOF
CR=`cat /tmp/tempo | grep "CR implemented" | awk -F\: '{print $2}'`
BF=`cat /tmp/tempo | grep "Bug solved" | awk -F\: '{print $2}'`
#echo ${CR} ${BF} > /tmp/crbf
PREPEND="update ticket set "
POSTPEND=" where id = ${TICKETID};"
if [ $CR = 'n.a.' ]; then
if [ $BF = 'n.a.' ]; then
exit
else
PREPEND=${PREPEND}" freekey8 = 'DEFECT', freetext8 = '"${BF}"'"
fi
else
PREPEND=${PREPEND}" freekey7 = 'CR', freetext7 = '"${CR}"'"
if [ $BF = 'n.a.' ]; then
echo do nothing > /dev/null
else
PREPEND=${PREPEND}" , freekey8 = 'DEFECT' , freetext8 = '"${BF}"'"
fi
fi
UPDATE=${PREPEND}${POSTPEND}
#echo ${UPDATE} > /tmp/update
mysql --user=otrs --password=xxxx otrs <
I've to rectify myself... CMD space in GenericAgent is more then enough for me because this mail goes to a generic queue and I just have to classify them. so, with the same criteria used in GA I can execute a script where it takes ticket_id (ARG[1]) and goes in article table with a batch select, it parse what I need and then, with the same ticket_id I make an update...
So simple ... I'm so lazy...I'm going to try this.
ciao,
MV
On Mon, Nov 23, 2009 at 12:43 AM, Marco Vannini
wrote: Yes it might be, I thought that a trigger could be faster end easiest and would not impact the normal and clean flow that PostMasterMailbox implements. I was thinking at a script that could be executed by the GenericAgent too but I cannot see how having just ARG[0] and ARG[1] that I think they are not enougth for my job. So, probably I'll go through a fetchmail/procmail solution that I think it's similar to what you told me.
Thank you very mutch.
cheers.
MV
On Sun, Nov 22, 2009 at 11:54 PM, James Morgan < james.morgan@vernet.net.au> wrote:
I did something similar to this with RT and OTRS. There’s a department here that uses RT and we use OTRS, so I wrote a script that can accept the piped output from sendmail (as an alias), parse the message subject (which had the RT number in it) and add the RT number to one of the FreeText fields. It also did a MySQL lookup on the ticket table to work out which ticket number in OTRS was correct for that RT number and then modified the subject line of the message to suit (added [Ticket#...] because RT strips it out).
I suggest it might be a decent option for you.
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Monday, 23 November 2009 9:36 AM
*To:* User questions and discussions about OTRS. *Subject:* Re: [otrs] freefield autofill
yes, it should be something like this.
ie, this is the incoming mail
from: ConfigurationManager
to: deployment, otrs
Subject: REV-EBIS version REV-EBIS_209.0.6.B1_IT Available for Test Environment
Body:
Availability in System Test environment.
Release REV-EBIS version REV-EBIS_209.0.6.B1_IT available for System Test environment on the Italian StarTeam server
Project: Business_Intelligence
View: REV-EBIS_209.0.6.B1_IT
CR implemented: n.a.
Bug Solved: 75948;76004
for the last two row I would like to get (for CR) n.a (or the values that could be present) and (for Bug Solved) 75948;76004 and populate freetext7 and freetext8 respectively.
On Sun, Nov 22, 2009 at 11:25 PM, James Morgan < james.morgan@vernet.net.au> wrote:
Sorry, I don’t understand the request. Are you wanting to parse the incoming message and then set FreeText fields accordingly?
*From:* otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] *On Behalf Of *Marco Vannini *Sent:* Saturday, 21 November 2009 2:43 AM *To:* User questions and discussions about OTRS. *Subject:* [otrs] freefield autofill
Hi all,
Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a mysql trigger or something else that parse incoming mail (so insert into) and take values and update the same record ?
thanks in advance.
MV
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW! http://www.otrs.com/en/support/enterprise-subscription/

Is there anyone that has an freefield autofiller just ready and modifiable ? I mean something like a
mysql trigger or something else that parse incoming mail (so insert into) and take values and update
the same record ?
Not sure if what we have done on our old OTRS 1.3.1 system is of any help to you. We have a New Start web form and a Leaver web form that is completed when someone new is coming to work in our offices or if someone is leaving. Each form generates an e-mail in a specific format with a string in the subject field that can be searched in the OTRS system. In OTRS we have set up two GenericAgent jobs which are run every 10 minutes with names such as 'New Start' and 'Leavers'. For example, the GenericAgent 'Leavers' job runs every 10 minutes, searches for "Leaver: *" at the start of the subject field, moves the ticket to the Leavers queue, CMD runs the /opt/otrs/CustomCode/Leavers.pl file, etc. The 'New Start' GenericAgent job is similar but searches for "New User: *" at the start of the subject field, moves the ticket to the 'New Start' queue, CMD runs the /opt/otrs/CustomCode/NewStarts.pl file. The Perl code for the NewStarts.pl and Leavers.pl scripts is appended to the end of this e-mail. Regards Paul McIlfatrick Leavers.pl ========== #!/usr/bin/perl -w use DBI; if (scalar @ARGV == 0) { print "This Perl script must be invoked with a ticket number as a parameter!\n"; exit; } $TicketNumber = $ARGV[0]; # $TicketID = $ARGV[1]; $freekey1 = "Centre last day"; $freetext1 = "?"; $freekey2 = "BT last day"; $freetext2 = ""; $freekey3 = "Approved"; $freetext3 = "Not yet"; $freekey4 = "FindFone"; $freetext4 = "Not yet disabled"; $freekey5 = "VoIP number"; $freetext5 = "Not yet freed up"; $freekey6 = "Locker key"; $freetext6 = "Not yet returned"; $freekey7 = "Mouse"; $freetext7 = "Not yet returned"; $freekey8 = ""; $freetext8 = ""; $going_offshore = 0; $dbh = DBI->connect("dbi:mysql:otrs:otrs.bfsec.bt.co.uk", "root", "serv1ces"); # Get contents from submitted Leaver form. $sql = "SELECT article.a_subject FROM article,ticket WHERE ticket.tn = $TicketNumber AND article.ticket_id = ticket.id"; $sth = $dbh->prepare($sql); $sth->execute(); @email_subject = $sth->fetchrow_array; $sth->finish; $subject = grep(/Leaver:/, @email_subject); if ($subject == 0) { print "Not a 'Leaver' SR!\n"; exit; } $going_offshore = grep(/going offshore/, @email_subject); if ($going_offshore == 1) { $freetext2 = "Going offshore"; } #print "@email_subject\n"; #print "\n"; #exit; $sql = "SELECT article.a_body FROM article,ticket WHERE ticket.tn = $TicketNumber AND article.ticket_id = ticket.id"; $sth = $dbh->prepare($sql); $sth->execute(); @email_body = $sth->fetchrow_array; $sth->finish; @lines = split(/\n/, $email_body[0]); foreach $line_val (@lines){ if ($line_val =~ m/^Last day in Centre:/i) { if ($line_val =~ m/\s*(\d+\/\d+\/\d+)\s*$/) { $freetext1 = $1; } #print "Centre last day='$freetext1'\n"; } elsif ($line_val =~ m/^Last day in BT:/i) { if ($line_val =~ m/\s*(\d+\/\d+\/\d+)\s*$/) { $freetext2 = $1; } #print "BT last day='$freetext2'\n"; } } #exit; $sql = "update ticket set freekey1='$freekey1', freetext1='$freetext1', freekey2='$freekey2', freetext2='$freetext2', freekey3='$freekey3', freetext3='$freetext3', freekey4='$freekey4', freetext4='$freetext4', freekey5='$freekey5', freetext5='$freetext5', freekey6='$freekey6', freetext6='$freetext6', freekey7='$freekey7', freetext7='$freetext7', freekey8='$freekey8', freetext8='$freetext8' WHERE tn='$TicketNumber'"; $sth = $dbh->prepare($sql); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; NewStarts.pl ============ #!/usr/bin/perl -w use DBI; if (scalar @ARGV == 0) { print "This Perl script must be invoked with a ticket number as a parameter!\n"; exit; } $TicketNumber = $ARGV[0]; $freekey1 = "Start date"; $freetext1 = "?"; $freekey2 = "Approved"; $freetext2 = "Not yet"; $freekey3 = "FindFone"; $freetext3 = "Not done"; $freekey4 = "Email"; $freetext4 = "Not done"; $freekey5 = "Enquiry email"; $freetext5 = "Not sent"; $freekey6 = "VoIP number"; $freetext6 = "Not allocated"; $freekey7 = "Locker number"; $freetext7 = "Not allocated"; $freekey8 = "Mouse"; $freetext8 = "Not given"; $dbh = DBI->connect("dbi:mysql:otrs:otrs.bfsec.bt.co.uk", "root", "serv1ces"); # Get contents from submitted new start form. $sql = "SELECT article.a_subject FROM article,ticket WHERE ticket.tn = $TicketNumber AND article.ticket_id = ticket.id"; $sth = $dbh->prepare($sql); $sth->execute(); @email_subject = $sth->fetchrow_array; #$contents = $row[0]; $sth->finish; $subject = grep(/New user:/, @email_subject); if ($subject == 0) { print "Not a 'New Start' SR!\n"; exit; } #print "@email_subject\n"; $sql = "SELECT article.a_body FROM article,ticket WHERE ticket.tn = $TicketNumber AND article.ticket_id = ticket.id"; $sth = $dbh->prepare($sql); $sth->execute(); @email_body = $sth->fetchrow_array; $sth->finish; @lines = split(/\n/, $email_body[0]); foreach $line_val (@lines){ if ($line_val =~ m/^User start date:/i) { if ($line_val =~ m/\s*(\d+\/\d+\/\d+)\s*$/) { $freetext1 = $1; } #print "User start date='$freetext1'\n"; } } #exit; $sql = "update ticket set freekey1='$freekey1', freetext1='$freetext1', freekey2='$freekey2', freetext2='$freetext2', freekey3='$freekey3', freetext3='$freetext3', freekey4='$freekey4', freetext4='$freetext4', freekey5='$freekey5', freetext5='$freetext5', freekey6='$freekey6', freetext6='$freetext6', freekey7='$freekey7', freetext7='$freetext7', freekey8='$freekey8', freetext8='$freetext8' WHERE tn='$TicketNumber'"; $sth = $dbh->prepare($sql); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; $dbh->disconnect;
participants (3)
-
James Morgan
-
Marco Vannini
-
paul.mcilfatrick@bt.com