Is it possible to set CustomField in mailgate plugin?

I’v got a mailgate plugin in which i am trying to set value to Ticket
CustomField.
I’m using this method:
my ($st,$msg) = $args{Ticket}->AddCustomFieldValue( Field => $CFObj->id,
Value => $id, RecordTransaction => 1 );

However this always fail with error message:
Failed to save CF value: 100 as value for CF. Error: Custom field 1 does
not apply to this object

This look like the CF value cannot be assigne just because the ticket
itself does not really exist yet. Is it the problem?

So my question:
is it to possible to assing some value to ticket CF in mailgate plugin ?

Best regards,

Pavel Šidlo

LinuxBox.cz, s.r.o.
28. října 168, 709 00 Ostrava

tel.: +420 591 166 234
mob.: +420 737 238 334
web: www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz

I’v got a mailgate plugin in which i am trying to set value to Ticket CustomField.
I’m using this method:
my ($st,$msg) = $args{Ticket}->AddCustomFieldValue( Field => $CFObj->id, Value => $id,
RecordTransaction => 1 );

However this always fail with error message:
Failed to save CF value: 100 as value for CF. Error: Custom field 1 does not apply to this
object

This look like the CF value cannot be assigne just because the ticket itself does not really
exist yet. Is it the problem?

What’s the Action? Is this during creation or a correspond/comment?
Normally folks do CF manipulation from Scrips rather than Mail
Plugins.

-kevin

Hello,

full scenario is like this:
new email arrive, new ticket is about to be created.
I want to check check “TO”, or “CC” email header addresses against some
special list of mail addresses.
If match is found, i need to store the address in CF.

I’d like to do the CF value assignment in mail plugin, because in mail
plugin i have complete mail object available.
So i know in which header the email address appeared.
However, it seems i can’t store the value in CF (within the mail plugin).
I gues it’s because we’re delaing with NEW ticket, so the ticket itself
does not really exists yet, therefore it is impossible to assign a CF
value to it.

I tried to do the stuff in Scrip, but in there i do not know in which
header
the address appeared.
There is some method “$self->TicketObj->TransactionAddresses()” which
return all addresses present in transaction, however there is not an
info about in which email header the address was present.
Maybe if there was any method to get the whole email message object
within scrip - but i do not know abou such.

I see i should specify my question more precisely:
Is it possible to assign value to CF, in mail plugin, when the email
message is about to create completely new ticket ?

Thanks in advance

Pavel Šidlo

LinuxBox.cz, s.r.o.
28. října 168, 709 00 Ostrava

tel.: +420 591 166 234
mob.: +420 737 238 334
web: www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz

|------------>
| Od: |
|------------>

--------------------------------------------------------------------------------------------------------------------------------------------------|
|Kevin Falcone falcone@bestpractical.com |
--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Komu: |
|------------>
--------------------------------------------------------------------------------------------------------------------------------------------------|
|rt-users@lists.bestpractical.com, |
--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Datum: |
|------------>
--------------------------------------------------------------------------------------------------------------------------------------------------|
|14.06.2013 17:28 |
--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Předmět: |
|------------>
--------------------------------------------------------------------------------------------------------------------------------------------------|
|Re: [rt-users] Is it possible to set CustomField in mailgate plugin? |
--------------------------------------------------------------------------------------------------------------------------------------------------|

I’v got a mailgate plugin in which i am trying to set value to Ticket
CustomField.
I’m using this method:
my ($st,$msg) = $args{Ticket}->AddCustomFieldValue( Field => $CFObj->
id, Value => $id,
RecordTransaction => 1 );

However this always fail with error message:
Failed to save CF value: 100 as value for CF. Error: Custom field 1
does not apply to this
object

This look like the CF value cannot be assigne just because the ticket
itself does not really
exist yet. Is it the problem?

What’s the Action? Is this during creation or a correspond/comment?
Normally folks do CF manipulation from Scrips rather than Mail
Plugins.

-kevin
[attachment “att0q8g1.dat” deleted by Pavel Šidlo/linuxbox/cz]

RT Training in Seattle, June 19-20: Training — Best Practical Solutions

If you use procmail → rt-mailgate, you could use procmail to modify the email to pass the field in the body where “CommandByMail” could pick it up (or the ExtractCustomField extension).

Thanks,
Jok
| Joachim Thuau | IT Systems Engineer - Linux / SpaceX |From: “pavel.sidlo@linuxbox.czmailto:pavel.sidlo@linuxbox.cz” <pavel.sidlo@linuxbox.czmailto:pavel.sidlo@linuxbox.cz>
Date: Tuesday, June 18, 2013 7:39 AM
To: “rt-users@lists.bestpractical.commailto:rt-users@lists.bestpractical.com” <rt-users@lists.bestpractical.commailto:rt-users@lists.bestpractical.com>
Subject: Re: [rt-users] Is it possible to set CustomField in mailgate plugin?

Hello,

full scenario is like this:
new email arrive, new ticket is about to be created.
I want to check check “TO”, or “CC” email header addresses against some
special list of mail addresses.
If match is found, i need to store the address in CF.

I’d like to do the CF value assignment in mail plugin, because in mail
plugin i have complete mail object available.
So i know in which header the email address appeared.
However, it seems i can’t store the value in CF (within the mail plugin).
I gues it’s because we’re delaing with NEW ticket, so the ticket itself
does not really exists yet, therefore it is impossible to assign a CF
value to it.

I tried to do the stuff in Scrip, but in there i do not know in which header
the address appeared.
There is some method “$self->TicketObj->TransactionAddresses()” which
return all addresses present in transaction, however there is not an
info about in which email header the address was present.
Maybe if there was any method to get the whole email message object
within scrip - but i do not know abou such.

I see i should specify my question more precisely:
Is it possible to assign value to CF, in mail plugin, when the email
message is about to create completely new ticket ?

Thanks in advance

Pavel Šidlo

LinuxBox.cz, s.r.o.
28. října 168, 709 00 Ostrava

tel.: +420 591 166 234
mob.: +420 737 238 334
web: www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.czmailto:servis@linuxbox.cz

[Inactive hide details for Kevin Falcone —14.06.2013 17:28:29—On Fri, Jun 14, 2013 at 01:23:45PM +0200, pavel.sidlo@linuxbox]Kevin Falcone —14.06.2013 17:28:29—On Fri, Jun 14, 2013 at 01:23:45PM +0200, pavel.sidlo@linuxbox.czmailto:pavel.sidlo@linuxbox.cz wrote: > I’v got a mailgate plu

Od:

Kevin Falcone <falcone@bestpractical.commailto:falcone@bestpractical.com>

Komu:

rt-users@lists.bestpractical.commailto:rt-users@lists.bestpractical.com,

Datum:

14.06.2013 17:28

Předmět:

Re: [rt-users] Is it possible to set CustomField in mailgate plugin?

I see i should specify my question more precisely:
Is it possible to assign value to CF, in mail plugin, when the email
message is about to create completely new ticket ?

I think the better question is “How do I get the To or Cc header from
within a Scrip” since you can’t set the custom field on a ticket that
doesn’t exist yet (bit of a chicken and egg problem there).

It sounds like you want to get the First Attachment of the Transaction
object passed into the Scrip during the Create and call GetHeader on
it - asking for the appropriate headers.

You can also get the attachment back as a perl MIME object if you’re
more comfortable with that, but you have all the rope you need in a
Scrip.

-kevin