Re: [rt-users] Custom Scrip that sometimes emails?
I'm not sure if you can get RT to send the mail for you (probably can, but I've not looked into it), but you should be able to send a mail yourself, using something like Mail::Sender (The documentation is in CPAN) Steve -Original Message- From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of John Hascall Sent: 16 January 2012 03:36 To: rt-users@lists.bestpractical.com Subject: [rt-users] Custom Scrip that sometimes emails? I have a custom scrip that does quite a lot of parsing of the content of an incoming email during ticket creation. Now I've been asked that under certain circumstances, determined by what it finds/doesn't find in the email, this scrip also send an email (to the requestor as well as possibly to an email address found in the message). I'm guessing this can't be that hard to do, but I've read the RT Essentials book and google'd everything I can think of to no avail. Does anyone know how to do this? (it's RT 3.8.1 if that matters) Thanks, John RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012 __ This email has been scanned by Westcoastcloud. http://www.westcoastcloud.com/ BiP Solutions Limited is a company registered in Scotland with Company Number SC086146 and VAT number 383030966 and having its registered office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ. This e-mail (and any attachment) is intended only for the attention of the addressee(s). Its unauthorised use, disclosure, storage or copying is not permitted. If you are not the intended recipient, please destroy all copies and inform the sender by return e-mail. This e-mail (whether you are the sender or the recipient) may be monitored, recorded and retained by BiP Solutions Ltd. E-mail monitoring/ blocking software may be used, and e-mail content may be read at any time.You have a responsibility to ensure laws are not broken when composing or forwarding e-mails and their contents. RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012
Re: [rt-users] Custom Scrip that sometimes emails?
On Mon, Jan 16, 2012 at 07:35, John Hascall j...@iastate.edu wrote: I have a custom scrip that does quite a lot of parsing of the content of an incoming email during ticket creation. Now I've been asked that under certain circumstances, determined by what it finds/doesn't find in the email, this scrip also send an email (to the requestor as well as possibly to an email address found in the message). I'm guessing this can't be that hard to do, but I've read the RT Essentials book and google'd everything I can think of to no avail. Does anyone know how to do this? Use second scrip that emails with Notify* actions. Probably your parser also updates ticket with info it found, so you can create condition that finds required situation. There are a few alternatives, but above is the right abstraction of code and maintainable solution. (it's RT 3.8.1 if that matters) Thanks, John RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012 -- Best regards, Ruslan. RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012
Re: [rt-users] Custom Scrip that sometimes emails?
On Mon, Jan 16, 2012 at 07:35, John Hascall j...@iastate.edu wrote: I have a custom scrip that does quite a lot of parsing of the content of an incoming email during ticket creation. Now I've been asked that under certain circumstances, determined by what it finds/doesn't find in the email, this scrip also send an email (to the requestor as well as possibly to an email address found in the message). Use second scrip that emails with Notify* actions. Probably your parser also updates ticket with info it found, so you can create condition that finds required situation. How do I insure that the two scrips execute in the correct order? Thanks, John RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012
Re: [rt-users] Custom Scrip that sometimes emails?
On Mon, Jan 16, 2012 at 19:19, John Hascall j...@iastate.edu wrote: On Mon, Jan 16, 2012 at 07:35, John Hascall j...@iastate.edu wrote: I have a custom scrip that does quite a lot of parsing of the content of an incoming email during ticket creation. Now I've been asked that under certain circumstances, determined by what it finds/doesn't find in the email, this scrip also send an email (to the requestor as well as possibly to an email address found in the message). Use second scrip that emails with Notify* actions. Probably your parser also updates ticket with info it found, so you can create condition that finds required situation. How do I insure that the two scrips execute in the correct order? I think in 3.8.1 we already order scrips by description, may be it's by id. However, you don't need it. Changes from a scrip fire new scrips. In second scrip you check that particular field was set by transaction, check new and old values, check other required fields and decide whether fire or not notification action. Advantage of this is that notification is fired even when people through UI changed ticket in similar way as your parser. Thanks, John -- Best regards, Ruslan. RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012
Re: [rt-users] Custom Scrip that sometimes emails?
On Mon, Jan 16, 2012 at 19:19, John Hascall j...@iastate.edu wrote: On Mon, Jan 16, 2012 at 07:35, John Hascall j...@iastate.edu wrote: I have a custom scrip that does quite a lot of parsing of the content of an incoming email during ticket creation. Now I've been asked that under certain circumstances, determined by what it finds/doesn't find in the email, this scrip also send an email (to the requestor as well as possibly to an email address found in the message). Use second scrip that emails with Notify* actions. Probably your parser also updates ticket with info it found, so you can create condition that finds required situation. How do I insure that the two scrips execute in the correct order? I think in 3.8.1 we already order scrips by description, may be it's by id. However, you don't need it. Changes from a scrip fire new scrips. In second scrip you check that particular field was set by transaction, check new and old values, check other required fields and decide whether fire or not notification action. Advantage of this is that notification is fired even when people through UI changed ticket in similar way as your parser. So, just to be sure I understand this correctly. The existing scrip, upon finding that the email is required, sets the value of a custom field (say, email = needed) This setting of a custom field will trigger RT to run through the list of scrips again. The condition of the new, (emailing), scrip is based on the custom field value (email==needed), so it is triggered on this run through. This scrip, after emailing, should, I would guess, then update the CF (say, email = sent). Correct? I am guessing that there is some way to not reinvent the wheel and use the abilities of an exist action, perhaps by being a subclass of it? Possible? Pointers on how? Many thanks, John RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012
Re: [rt-users] Custom Scrip that sometimes emails?
On Mon, Jan 16, 2012 at 21:14, John Hascall j...@iastate.edu wrote: On Mon, Jan 16, 2012 at 19:19, John Hascall j...@iastate.edu wrote: On Mon, Jan 16, 2012 at 07:35, John Hascall j...@iastate.edu wrote: I have a custom scrip that does quite a lot of parsing of the content of an incoming email during ticket creation. Now I've been asked that under certain circumstances, determined by what it finds/doesn't find in the email, this scrip also send an email (to the requestor as well as possibly to an email address found in the message). Use second scrip that emails with Notify* actions. Probably your parser also updates ticket with info it found, so you can create condition that finds required situation. How do I insure that the two scrips execute in the correct order? I think in 3.8.1 we already order scrips by description, may be it's by id. However, you don't need it. Changes from a scrip fire new scrips. In second scrip you check that particular field was set by transaction, check new and old values, check other required fields and decide whether fire or not notification action. Advantage of this is that notification is fired even when people through UI changed ticket in similar way as your parser. So, just to be sure I understand this correctly. The existing scrip, upon finding that the email is required, sets the value of a custom field (say, email = needed) This setting of a custom field will trigger RT to run through the list of scrips again. The condition of the new, (emailing), scrip is based on the custom field value (email==needed), so it is triggered on this run through. This scrip, after emailing, should, I would guess, then update the CF (say, email = sent). Correct? Close and will work, but I don't understand why you need special custom field for that. Probably I just lack information about what your parser does with ticket after parsing. I am guessing that there is some way to not reinvent the wheel and use the abilities of an exist action, perhaps by being a subclass of it? I don't see why you need to sub-class any of RT's actions in this case. Possible? Pointers on how? Use file based actions and just inherit from a module you want to sub-class. You have to register your module in DB (see wiki). Also, actions and conditions based on files can use argument for configuration. Many thanks, John -- Best regards, Ruslan. RT Training Sessions (http://bestpractical.com/services/training.html) * Boston March 5 6, 2012