Custom fields in transaction

Hi,

I’m trying to assign the ticket to a queue based on a transaction
custom field, but I am unable to fetch the custom field in my scrip.

Scrip details:
Condition: On correspond
Action: User defined
Template: Blank

Custom condition:
1;

Custom action preparation code:
1;

Custom action commit code:
my $queueName = $self->TicketObj->QueueObj->Name;
RT::Logger->info(“Queue name: $queueName”);

my $trans = $self->TransactionObj;
RT::Logger->info($trans->FirstCustomFieldValue(“Product”));

The method FirstCustomFieldValue returns empty even though the value is
set in form submission.

All the stuff I found on Google are about custom fields in tickets,
seems nobody uses transaction custom fields?

I’m using RT 4.4.0.

Nilesh

Hi,

I’m trying to assign the ticket to a queue based on a transaction
custom field, but I am unable to fetch the custom field in my scrip.

Scrip details:
Condition: On correspond
Action: User defined
Template: Blank

Custom condition:
1;

Custom action preparation code:
1;

Custom action commit code:
my $queueName = $self->TicketObj->QueueObj->Name;
RT::Logger->info(“Queue name: $queueName”);

my $trans = $self->TransactionObj;
RT::Logger->info($trans->FirstCustomFieldValue(“Product”));


The method FirstCustomFieldValue returns empty even though the value is
set in form submission.

All the stuff I found on Google are about custom fields in tickets,
seems nobody uses transaction custom fields?

I’m using RT 4.4.0.

If you are submitting the value for Product in the same update, the On
Correspond transaction may run before the value is committed, so it’s
not there yet. Try moving the scrip to Batch stage rather than Normal.
Batch runs at the end, so the value should be set.

Can you provide some example?
On the wiki I saw some scrip which was testing the return value of
TransactionBatch method, but now after doing that I don’t see the log.

In custom action commit code:

my $batch = $self->TicketObj->TransactionBatch;
if($batch) {
RT::Logger->info(“transaction batch”);
RT::Logger->info("Field Value: " . $self->TransactionObj-

FirstCustomFieldValue(‘Product’));
}

NileshOn 01-Jul-2016 10:52 pm, “Jim Brandt” jbrandt@bestpractical.com wrote:

On 6/30/16 11:41 PM, Nilesh wrote:

Hi,

I’m trying to assign the ticket to a queue based on a transaction
custom field, but I am unable to fetch the custom field in my scrip.

Scrip details:
Condition: On correspond
Action: User defined
Template: Blank

Custom condition:
1;

Custom action preparation code:
1;

Custom action commit code:
my $queueName = $self->TicketObj->QueueObj->Name;
RT::Logger->info(“Queue name: $queueName”);

my $trans = $self->TransactionObj;
RT::Logger->info($trans->FirstCustomFieldValue(“Product”));


The method FirstCustomFieldValue returns empty even though the value
is
set in form submission.

All the stuff I found on Google are about custom fields in tickets,
seems nobody uses transaction custom fields?

I’m using RT 4.4.0.

If you are submitting the value for Product in the same update, the On
Correspond transaction may run before the value is committed, so it’s
not there yet. Try moving the scrip to Batch stage rather than Normal.
Batch runs at the end, so the value should be set.

RT 4.4 and RTIR Training Sessions https://bestpractical.com/training

  • Los Angeles - September, 2016

Nilesh

The use case is simple,

I want to move tickets to different queues based on a custom field and
this should happen when the agent is replying. So transaction is the
best place to introduce such a field.

NileshOn Tue, 2016-07-05 at 20:00 +0530, aniket tripathy wrote:

Hi Nilesh,

Can you please explain,the use case. Just trying to understand the
scenario where a transaction custom field would be best fit.

Thanks.
-Aniket

On Fri, Jul 1, 2016 at 9:11 AM, Nilesh me@nileshgr.com wrote:

Hi,

I’m trying to assign the ticket to a queue based on a transaction
custom field, but I am unable to fetch the custom field in my
scrip.

Scrip details:
Condition: On correspond
Action: User defined
Template: Blank

Custom condition:
1;

Custom action preparation code:
1;

Custom action commit code:
my $queueName = $self->TicketObj->QueueObj->Name;
RT::Logger->info(“Queue name: $queueName”);

my $trans = $self->TransactionObj;
RT::Logger->info($trans->FirstCustomFieldValue(“Product”));


The method FirstCustomFieldValue returns empty even though the
value is
set in form submission.

All the stuff I found on Google are about custom fields in tickets,
seems nobody uses transaction custom fields?

I’m using RT 4.4.0.


Nilesh


RT 4.4 and RTIR Training Sessions https://bestpractical.com/trainin
g

  • Los Angeles - September, 2016

Each scrip has a stage that is set as part of the configuration through
the web UI. You should be able to find it on the Applies to tab when
configuring the scrip. By default, it will be set to Normal. To get the
scrip to run at the end in batch mode, you need to set that to Batch and
save the scrip.On 7/1/16 10:29 PM, Nilesh wrote:

Can you provide some example?
On the wiki I saw some scrip which was testing the return value of
TransactionBatch method, but now after doing that I don’t see the log.

In custom action commit code:

my $batch = $self->TicketObj->TransactionBatch;
if($batch) {
RT::Logger->info(“transaction batch”);
RT::Logger->info("Field Value: " . $self->TransactionObj-

FirstCustomFieldValue(‘Product’));
}


Nilesh

On 01-Jul-2016 10:52 pm, “Jim Brandt” jbrandt@bestpractical.com wrote:

On 6/30/16 11:41 PM, Nilesh wrote:

Hi,

I’m trying to assign the ticket to a queue based on a transaction
custom field, but I am unable to fetch the custom field in my scrip.

Scrip details:
Condition: On correspond
Action: User defined
Template: Blank

Custom condition:
1;

Custom action preparation code:
1;

Custom action commit code:
my $queueName = $self->TicketObj->QueueObj->Name;
RT::Logger->info(“Queue name: $queueName”);

my $trans = $self->TransactionObj;
RT::Logger->info($trans->FirstCustomFieldValue(“Product”));


The method FirstCustomFieldValue returns empty even though the value
is
set in form submission.

All the stuff I found on Google are about custom fields in tickets,
seems nobody uses transaction custom fields?

I’m using RT 4.4.0.

If you are submitting the value for Product in the same update, the On
Correspond transaction may run before the value is committed, so it’s
not there yet. Try moving the scrip to Batch stage rather than Normal.
Batch runs at the end, so the value should be set.


RT 4.4 and RTIR Training Sessions https://bestpractical.com/training

  • Los Angeles - September, 2016

For some reason I didn’t see that option first when I wrote this message or
it seemed to be absent. The problem is solved now, scrapped the idea of
classifying by custom field and instead using regex to search inside
subject & content.On Wed, Jul 6, 2016 at 5:56 PM, Jim Brandt jbrandt@bestpractical.com wrote:

Each scrip has a stage that is set as part of the configuration through
the web UI. You should be able to find it on the Applies to tab when
configuring the scrip. By default, it will be set to Normal. To get the
scrip to run at the end in batch mode, you need to set that to Batch and
save the scrip.

On 7/1/16 10:29 PM, Nilesh wrote:

Can you provide some example?
On the wiki I saw some scrip which was testing the return value of
TransactionBatch method, but now after doing that I don’t see the log.

In custom action commit code:

my $batch = $self->TicketObj->TransactionBatch;
if($batch) {
RT::Logger->info(“transaction batch”);
RT::Logger->info("Field Value: " . $self->TransactionObj-

FirstCustomFieldValue(‘Product’));

}


Nilesh

On 01-Jul-2016 10:52 pm, “Jim Brandt” jbrandt@bestpractical.com wrote:

On 6/30/16 11:41 PM, Nilesh wrote:

Hi,

I’m trying to assign the ticket to a queue based on a transaction
custom field, but I am unable to fetch the custom field in my scrip.

Scrip details:
Condition: On correspond
Action: User defined
Template: Blank

Custom condition:
1;

Custom action preparation code:
1;

Custom action commit code:
my $queueName = $self->TicketObj->QueueObj->Name;
RT::Logger->info(“Queue name: $queueName”);

my $trans = $self->TransactionObj;
RT::Logger->info($trans->FirstCustomFieldValue(“Product”));


The method FirstCustomFieldValue returns empty even though the value
is
set in form submission.

All the stuff I found on Google are about custom fields in tickets,
seems nobody uses transaction custom fields?

I’m using RT 4.4.0.

If you are submitting the value for Product in the same update, the On
Correspond transaction may run before the value is committed, so it’s
not there yet. Try moving the scrip to Batch stage rather than Normal.
Batch runs at the end, so the value should be set.


RT 4.4 and RTIR Training Sessions https://bestpractical.com/training

  • Los Angeles - September, 2016

Hi all,

Using RT4.4
Is there some kind of way to automatically calculate the has of an attachment in RT and putting this in a custom field?
I cannot see a way to acomplish this automatically in RT itself…
The only way Ican think of is using the RT external storage option and calculating the hash on the other system, but can’t see how to get the hash back into RT)
Any ideas…?

Kind regards
T