Scip adding custom 'Results' line / Stopping transaction 'Set'

Hi,

I’ve got some custom fields for 3-point time estimates on project tickets. I’ve got it so that upon creation / update of the custom field, the ‘TimeEstimated’ field gets set to the ‘Most Likely’ custom field value. I’ve also got it so that it ignores any changes made manually to the ‘TimeEstimated’ field.

So far, so good.

I’d like to feed back to users that changes to the ‘TimeEstimated’ field shouldn’t be made, that the 3-point fields should be modified together in order for changes to be made.

The most logical way to do this (to me) is to feed a ‘Result’ (what’s expanded from @actions in ‘share/html/Elements/ListActions’) so it can be displayed in the box at the top of the page when a ticket update occurs. I just can’t find out how to do that.

I see that most of the messages come from Transaction_Overlay.pm/BriefDescriptions, but I can see that the messages from that function are generated automatically based on what the transaction actually is.

So, here’s my question:

* Using a Scrip Condition / Prep, can a 'Set' be rejected to not occur and thus raise an 'error' ?
* If not, is there a way to feed back a custom message into the BriefDescriptions / @actions array so my own message can be displayed?

Current scrip:

Description: Re-Populate Estimate
Condition: User Defined
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate
Custom Condition:

my $_CF_NAME = ‘3 Point: Most Likely’;
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $_CF = RT::CustomField->new ( $RT::SystemUser );
$_CF->LoadByNameAndQueue( Name => $_CF_NAME, Queue => $self->TicketObj->QueueObj->Name );

if (
$trans->Type eq ‘Create’ ||
($trans->Type eq ‘CustomField’ && $trans->Field == $_CF->id) ||
($trans->Type eq ‘Set’ && $trans->Field == ‘TimeEstimated’)
) {
return 1;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

my $_CF_NAME = ‘3 Point: Most Likely’;

my $ticket = $self->TicketObj;
my $queue = $ticket->QueueObj->Name;
my $trans = $self->TransactionObj;

my $_CF = RT::CustomField->new ( $RT::SystemUser );
$_CF->LoadByNameAndQueue( Name => $_CF_NAME, Queue => $queue);
unless ($_CF->id) {
$RT::Logger->warning ("$_CF_NAME doesn’t exist in Queue " . $queue);
return undef;
}

my $most_likely = $ticket->FirstCustomFieldValue($_CF->id);

if ($most_likely ne ‘’ && $most_likely != $ticket->TimeEstimated) {
$RT::Logger->info(sprintf(“Setting TimeEstimated from %s to value %s”, $ticket->TimeEstimated, $most_likely));
$ticket->SetTimeEstimated($most_likely);
}

return 1;

Stuart J. Browne
Senior Unix Administrator, Network Administrator
AusRegistry Pty Ltd
Level 8, 10 Queens Road
Melbourne. Victoria. Australia. 3004.
Ph: +61 3 9866 3710
Fax: +61 3 9866 1970
Email: stuart.browne@ausregistry.com.au
Web: www.ausregistry.com.au

The information contained in this communication is intended for the named recipients only. It is subject to copyright and may contain legally privileged and confidential information and if you are not an intended recipient you must not use, copy, distribute or take any action in reliance on it. If you have received this communication in error, please delete all copies from your system and notify us immediately.

This is a re-send as no response in the week it was posted.
Hi,

I’ve got some custom fields for 3-point time estimates on project tickets. I’ve got it so that upon creation / update of the custom field, the ‘TimeEstimated’ field gets set to the ‘Most Likely’ custom field value. I’ve also got it so that it ignores any changes made manually to the ‘TimeEstimated’ field.

So far, so good.

I’d like to feed back to users that changes to the ‘TimeEstimated’ field shouldn’t be made, that the 3-point fields should be modified together in order for changes to be made.

The most logical way to do this (to me) is to feed a ‘Result’ (what’s expanded from @actions in ‘share/html/Elements/ListActions’) so it can be displayed in the box at the top of the page when a ticket update occurs. I just can’t find out how to do that.

I see that most of the messages come from Transaction_Overlay.pm/BriefDescriptions, but I can see that the messages from that function are generated automatically based on what the transaction actually is.

So, here’s my question:

* Using a Scrip Condition / Prep, can a 'Set' be rejected to not occur and thus raise an 'error' ?
* If not, is there a way to feed back a custom message into the BriefDescriptions / @actions array so my own message can be displayed?

Current scrip:

Description: Re-Populate Estimate
Condition: User Defined
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate
Custom Condition:

my $_CF_NAME = ‘3 Point: Most Likely’;
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $_CF = RT::CustomField->new ( $RT::SystemUser );
$_CF->LoadByNameAndQueue( Name => $_CF_NAME, Queue => $self->TicketObj->QueueObj->Name );

if (
$trans->Type eq ‘Create’ ||
($trans->Type eq ‘CustomField’ && $trans->Field == $_CF->id) ||
($trans->Type eq ‘Set’ && $trans->Field == ‘TimeEstimated’)
) {
return 1;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

my $_CF_NAME = ‘3 Point: Most Likely’;

my $ticket = $self->TicketObj;
my $queue = $ticket->QueueObj->Name;
my $trans = $self->TransactionObj;

my $_CF = RT::CustomField->new ( $RT::SystemUser );
$_CF->LoadByNameAndQueue( Name => $_CF_NAME, Queue => $queue);
unless ($_CF->id) {
$RT::Logger->warning ("$_CF_NAME doesn’t exist in Queue " . $queue);
return undef;
}

my $most_likely = $ticket->FirstCustomFieldValue($_CF->id);

if ($most_likely ne ‘’ && $most_likely != $ticket->TimeEstimated) {
$RT::Logger->info(sprintf(“Setting TimeEstimated from %s to value %s”, $ticket->TimeEstimated, $most_likely));
$ticket->SetTimeEstimated($most_likely);
}

return 1;

Stuart J. Browne
Senior Unix Administrator, Network Administrator
AusRegistry Pty Ltd
Level 8, 10 Queens Road
Melbourne. Victoria. Australia. 3004.
Ph: +61 3 9866 3710
Fax: +61 3 9866 1970
Email: stuart.browne@ausregistry.com.au
Web: www.ausregistry.com.au

The information contained in this communication is intended for the named recipients only. It is subject to copyright and may contain legally privileged and confidential information and if you are not an intended recipient you must not use, copy, distribute or take any action in reliance on it. If you have received this communication in error, please delete all copies from your system and notify us immediately.