Mailing List Archive

Scrip condition not for Reminders
Hello,

We use a RT scrip to check on close if a Custom filed is empty. If the Custom field is empty, the script reopens the ticket.

Condition: On Resolved

Custom action preparation code:
if( ! $self->TicketObj-> FirstCustomFieldValue( 'FieldName' ) ) {
$self->TicketObj->SetStatus('open');
}else{
$self->TicketObj->AddCustomFieldValue(
Field => 'FieldName',
Value => 'true');
}



Now we have a problem with the reminders: When I close a reminder the scrip reopen it.

Is there a way to prevent this?

Thank you,
Tobi
Re: Scrip condition not for Reminders [ In reply to ]
Hi Tobi,

A ticket object has a type method that will return a string when called:
https://docs.bestpractical.com/rt/4.4.1/RT/Ticket.html#Type1

Something like the following should help:

if ( $self->TicketObj->Type ne 'reminder ) {
$self->TicketObj->SetStatus('open');
}

Best Regards

Martin

On 2016-11-11 08:01, Tobias W. wrote:
> Hello,
>
> We use a RT scrip to check on close if a Custom filed is empty. If the
> Custom field is empty, the script reopens the ticket.
>
> Condition: On Resolved
>
> Custom action preparation code:
> if( ! $self->TicketObj-> FirstCustomFieldValue( 'FieldName' ) ) {
> $self->TicketObj->SetStatus('open');
> }else{
> $self->TicketObj->AddCustomFieldValue(
> Field => 'FieldName',
> Value => 'true');
> }
>
> Now we have a problem with the reminders: When I close a reminder the
> scrip reopen it.
>
> Is there a way to prevent this?
>
> Thank you,
> Tobi
>
> ---------
> RT 4.4 and RTIR training sessions, and a new workshop day!
> https://bestpractical.com/training
> * Los Angeles - January 9-11 2017
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017
Re: Scrip condition not for Reminders [ In reply to ]
Your very welcome :)

Martin

On 2016-11-11 16:38, Tobias W. wrote:
> Hi Martin,
>
> thank you for your tip.
>
> Now works fine!
>
> Thank you and Best Regards,
>
> Tobi
>
> -------------------------
>
> VON: Martin Wheldon <martin.wheldon@greenhills-it.co.uk>
> GESENDET: Freitag, 11. November 2016 12:31
> AN: Tobias W.
> CC: rt-users@lists.bestpractical.com
> BETREFF: Re: [rt-users] Scrip condition not for Reminders
>
> Hi Tobi,
>
> A ticket object has a type method that will return a string when
> called:
> https://docs.bestpractical.com/rt/4.4.1/RT/Ticket.html#Type1 [1]
>
> Something like the following should help:
>
> if ( $self->TicketObj->Type ne 'reminder ) {
> $self->TicketObj->SetStatus('open');
> }
>
> Best Regards
>
> Martin
>
> On 2016-11-11 08:01, Tobias W. wrote:
>> Hello,
>>
>> We use a RT scrip to check on close if a Custom filed is empty. If
> the
>> Custom field is empty, the script reopens the ticket.
>>
>> Condition: On Resolved
>>
>> Custom action preparation code:
>> if( ! $self->TicketObj-> FirstCustomFieldValue( 'FieldName' ) ) {
>> $self->TicketObj->SetStatus('open');
>> }else{
>> $self->TicketObj->AddCustomFieldValue(
>> Field => 'FieldName',
>> Value => 'true');
>> }
>>
>> Now we have a problem with the reminders: When I close a reminder
> the
>> scrip reopen it.
>>
>> Is there a way to prevent this?
>>
>> Thank you,
>> Tobi
>>
>> ---------
>> RT 4.4 and RTIR training sessions, and a new workshop day!
>> https://bestpractical.com/training [2]
>> * Los Angeles - January 9-11 2017
>
>
> Links:
> ------
> [1] https://docs.bestpractical.com/rt/4.4.1/RT/Ticket.html#Type1
> [2] https://bestpractical.com/training
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017