[rt-users] [Fwd: Create Ticket but only if Custom Field is...]
Huw Selley
huws at s2s.ltd.uk
Fri Nov 9 09:39:11 EST 2007
Hi,
The syntax errror is a missing semicolon on the first line.
return 0 unless $self->TransactionObj->Type eq "Resolved"
Should be
return 0 unless $self->TransactionObj->Type eq "Resolved";
Hope this helps.
Huw
On 9/11/07 2:34, "Matt Westfall" <mwestfall at factory7.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> OK The scrip is running, but it says there are syntax errors!!!
>
> Nov 9 09:32:44 oakie RT: Scrip 22 IsApplicable failed: Global symbol
> "$trans" requires explicit package name at (eval 1780) line 1.
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:45 oakie RT: Scrip 23 IsApplicable failed: syntax error at
> (eval 1784) line 2, near ""Resolved" return"
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:45 oakie RT:
> <rt-3.6.5-3157-1194618764-1136.159-19-0 at rt.factory7.com> #159/2613 -
> Scrip 19 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:32:45 oakie RT:
> <rt-3.6.5-3157-1194618764-1136.159-19-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
> Nov 9 09:32:48 oakie RT: Encode::Guess failed: ; fallback to iso-8859-1
> (/opt/rt3/lib/RT/I18N.pm:412)
> Nov 9 09:32:49 oakie RT: Encode::Guess failed: ; fallback to iso-8859-1
> (/opt/rt3/lib/RT/I18N.pm:412)
> Nov 9 09:32:50 oakie RT: Scrip 22 IsApplicable failed: Global symbol
> "$trans" requires explicit package name at (eval 2779) line 1.
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:51 oakie RT: Scrip 23 IsApplicable failed: syntax error at
> (eval 2783) line 2, near ""Resolved" return"
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:55 oakie RT: Scrip 22 IsApplicable failed: Global symbol
> "$trans" requires explicit package name at (eval 1816) line 1.
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:56 oakie RT: Scrip 23 IsApplicable failed: syntax error at
> (eval 1820) line 2, near ""Resolved" return"
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:56 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-8-0 at rt.factory7.com> #159/2615 -
> Scrip 8 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:32:56 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-8-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
> Nov 9 09:32:57 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-9-0 at rt.factory7.com> #159/2615 -
> Scrip 9 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:32:57 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-9-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
> Nov 9 09:32:57 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-18-0 at rt.factory7.com> #159/2615 -
> Scrip 18 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:32:57 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-18-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
> Nov 9 09:32:58 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-19-0 at rt.factory7.com> #159/2615 -
> Scrip 19 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:32:58 oakie RT:
> <rt-3.6.5-3171-1194618774-1371.159-19-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
> Nov 9 09:32:59 oakie RT: Scrip 22 IsApplicable failed: Global symbol
> "$trans" requires explicit package name at (eval 1870) line 1.
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:32:59 oakie RT: Scrip 23 IsApplicable failed: syntax error at
> (eval 1874) line 2, near ""Resolved" return"
> (/opt/rt3/lib/RT/Condition/UserDefined.pm:69)
> Nov 9 09:33:00 oakie RT:
> <rt-3.6.5-3171-1194618779-1446.159-10-0 at rt.factory7.com> #159/2616 -
> Scrip 10 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:33:00 oakie RT:
> <rt-3.6.5-3171-1194618779-1446.159-10-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
> Nov 9 09:33:00 oakie RT:
> <rt-3.6.5-3171-1194618779-290.159-19-0 at rt.factory7.com> #159/2616 -
> Scrip 19 (/opt/rt3/lib/RT/Action/SendEmail.pm:252)
> Nov 9 09:33:00 oakie RT:
> <rt-3.6.5-3171-1194618779-290.159-19-0 at rt.factory7.com> No recipients
> found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:264)
>
> Todd Chapman wrote:
>> So the scrip never fires?
>>
>> Try this:
>>
>> return 0 unless $self->TransactionObj->Type eq "Resolved"
>> return 0 unless $self->TicketObj->FirstCustomFieldValue('Followup') =~
>> /Yes/i;
>> $RT::Logger->debug("Scrip running");
>> 1;
>>
>> See if that puts an entry in your logs.
>>
>> ----------------
>> Now playing: Arctic Monkeys - The Bad Thing
>> http://foxytunes.com/artist/arctic+monkeys/track/the+bad+thing
>>
>> On 11/7/07, Matt Westfall <mwestfall at factory7.com> wrote:
>> OK For my scrip I have:
>>
>> Condition: User Defined
>> Action: Create Tickets
>> Template: Create-Followup
>> Stage: Transaction Create
>>
>> User Condition is:
>>
>> return 0 unless $self->TransactionObj->Type eq "Resolved"
>>
>> return 0 unless $self->TicketObj->FirstCustomFieldValue('Followup') =~
>> /Yes/i;
>>
>> 1;
>>
>> My Template is:
>>
>> ===Create-Ticket: generate-followup
>> Queue: Customer Service
>> Subject: Invoice: { $Tickets{'TOP'} -> Subject() }
>> Requestor: {$Tickets{'TOP'}->OwnerObj->EmailAddress() }
>> RefersTo: {$Tickets{'TOP'}->Id() }
>> Content: A follow up was requested on this ticket. Please refer to
>> previous ticket for more information.
>> ENDOFCONTENT
>>
>> And still no joy :( :(
>>
>> Todd Chapman wrote:
>>>>> ----------------
>>>>> Now playing: The Decemberists - Summersong
>>>>> http://foxytunes.com/artist/the+decemberists/track/summersong
>>>>>
>>>>> On 11/5/07, Matt Westfall <mwestfall at factory7.com> wrote:
>>>>> There are two TransactionObj there. So would
>>>>>
>>>>> unless ( $self->TransactionObj->Type eq "Resolved" &&
>>>>> $self->TransactionObj->Field == FIELD_ID )
>>>>> { return 0; }
>>>>>
>>>>> return 0 unless $self->TicketObj->FirstCustomFieldValue('Followup') =~
>>>>> /Yes/i;
>>>>>
>>>>> 1;
>>>>>
>>>>>
>>>>> The first check would 1) ensure that the ticket is being resolved &&
>>>>> That the CustomField is Set.
>>>>>
>>>>> Then if Followup is Yes, it would then return 1?
>>>>>
>>>>> What is the purpose of self->transactionobj->Field == ####??
>>>>>
>>>>>
>>>>>> That part doesn't make sense. Get rid of it.
>>>>> Should I just be checking for if it's Resolved, and if so, checking value?
>>>>>
>>>>>
>>>>>> Yes.
>>>>> Thanks,
>>>>> Matt
>>>>> Tim Wilson wrote:
>>>>>>>>>>> On Mon, Nov 5, 2007 at 1:41 PM, in message
>>>>>>>>>>> <472F7200.8080507 at factory7.com>,
>>>>>>>> Matt Westfall <mwestfall at factory7.com> wrote:
>>>>>>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>>>>>>> I did see that page on the Wiki. However, I am trying to take an
>>>>>>>>> action
>>>>>>>>> when the ticket is resolved, and if a custom field is something.
>>>>>>>> On this part...
>>>>>>>>
>>>>>>>> unless (
>>>>>>>> ( $self->TransactionObj->Type eq "CustomField"
>>>>>>>> && $self->TransactionObj->Field == FIELD_ID )
>>>>>>>> || $self->TransactionObj->Type eq "Create"
>>>>>>>> ) {
>>>>>>>> return 0;
>>>>>>>> }
>>>>>>>>
>>>>>>>> return 0 unless
>>>>>>>> $self->TicketObj->FirstCustomFieldValue('CUSTOM_FIELD_NAME') =~
>>>>>>>> /CUSTOM_FIELD_VALUE/i;
>>>>>>>>
>>>>>>>> 1;
>>>>>>>>
>>>>>>>> You could probaby change the TransactionObj type to "Resolved."
>>>>>>>>
>>>>>>>> -Tim
>>>>>>>>
>>>>>>>>
>> _______________________________________________
>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>> SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
>> If you sign up for a new RT support contract before December 31, we'll take
>> up to 20 percent off the price. This sale won't last long, so get in
>> touch today.
>> Email us at sales at bestpractical.com or call us at +1 617 812 0745.
>>>>>>
>> Community help: http://wiki.bestpractical.com
>> Commercial support: sales at bestpractical.com
>>>>>>
>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>> Buy a copy at http://rtbook.bestpractical.com
>>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
>
> iD8DBQFHNG/Yb/8X6V5MpAURAlomAJ9SgR51/SebgL/UPT8E3ddddXRx2gCdHEYS
> iAwZdZ77T2/i/H3E+2QwZn4=
> =bDnK
> -----END PGP SIGNATURE-----
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
>
> If you sign up for a new RT support contract before December 31, we'll take
> up to 20 percent off the price. This sale won't last long, so get in touch
> today.
> Email us at sales at bestpractical.com or call us at +1 617 812 0745.
>
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
s2s company email disclaimer : http://www.s2s.ltd.uk/datasheets/email_disclaimer.pdf
s2s company registration number : 3952958
s2s VAT registration number : GB763132055
Business premises : Ground Floor, Overline House, Crawley, West Sussex, RH10 1JA
Registered address : 29 High Street, Crawley, West Sussex, RH10 1BQ
Place of registration : England
More information about the rt-users
mailing list