Re: [rt-users] Sending E-Mail From Within Custom Scrips
Hello Tim, As no one has responded, I'll chime in with my non-canonical(?) way that only requires MIME::Entity. Create a script that fires on whatever condition you wish. In the preparation code, build a MIME::Entity object, and then $mime_object->send. That sends a mail from RT, but doesn't create any transaction. So an easy solution would be something like this in the prep-area: my $body = MIME::Entity->build(Type => "multipart/mixed", >From => $fromAddress, Subject => $subject, To => $toAddress, Data => ["Hello\n", "Close the ticket.\n" "Best regards,\n" "IT Crowd."]); $body->send; Docs are found here; http://search.cpan.org/~dskoll/MIME-tools-5.508/lib/MIME/Entity.pm Best regards, Thomas Oddsund RT/SDS/USIT Fra: rt-users <rt-users-boun...@lists.bestpractical.com> på vegne av Tim Gustafson <t...@ucsc.edu> Sendt: 14. desember 2016 23:17 Til: rt-users@lists.bestpractical.com Emne: [rt-users] Sending E-Mail From Within Custom Scrips Our university has an "official" ticketing system, and one of our support groups wants to use RT instead. To make this happen, we're configuring the "official" ticketing system to send e-mail to an RT queue. We've written a custom "on create" scrip in that queue that modifies the ticket when it comes in to set the "Requester" correctly (e-mail from the other system comes from a fixed address, not from the client's address; we parse the contents of the e-mail to ascertain the client's e-mail address directly). We'd like our custom scrip to also send an e-mail to the other system to close that ticket. What's the canonical way to send e-mail from RT to an external address without adding correspondence to the RT ticket itself? I found some documentation about how to add a transaction to the ticket from within the scrip, which generates an e-mail, but that's not really what I want to do here. I'd rather send a basic plain-text e-mail from within the scrip. Is that possible? -- Tim Gustafson t...@ucsc.edu 831-459-5354 Baskin Engineering, Room 313A - 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: [rt-users] Searching for tickets with empty CF in RT 4.2.8
Hello, Thanks for your response Matt. Unfortunately, that doesn't help, as I have another search for that(new tickets doesn't have any value in the CF, and the CF is set manually once the ticket is taken). Best regards, Thomas Oddsund RT/SDS/USIT Fra: Matt Zagrabelny <mzagr...@d.umn.edu> Sendt: 9. desember 2016 15:23 Til: Thomas Oddsund Kopi: rt-users@lists.bestpractical.com Emne: Re: [rt-users] Searching for tickets with empty CF in RT 4.2.8 Hi Thomas, On Fri, Dec 9, 2016 at 4:53 AM, Thomas Oddsund <thomas.odds...@usit.uio.no> wrote: > Hello, > > I have some saved searches on my dashboard. Three of them are based on a > Custom Field; one show tickets where the CF is set to X, one where CF is set > to Y, and one is supposed to show tickets tagged with something other then X > or Y. > To make the third search, I created the following search; > Queue = 'foo' > AND CF.{bar} != 'X' > AND CF.[bar] != 'Y' > AND ( > Status = 'new' > OR Status = 'open' > OR Status = 'stalled' ) > > However, tickets marked with either X or Y are still appearing in the result. > The same result was returned if i changed != to "NOT LIKE", and if I removed > either the X or Y part. > > Is this a bug, is there something wrong with our RT instance or is there > something I've overlooked? I'm not sure about answering this question, but you can search for tickets with empty CF values using the Advanced editing option of a Search: 'CF.{bar}' is null -m - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Los Angeles - January 9-11 2017
[rt-users] Searching for tickets with empty CF in RT 4.2.8
Hello, I have some saved searches on my dashboard. Three of them are based on a Custom Field; one show tickets where the CF is set to X, one where CF is set to Y, and one is supposed to show tickets tagged with something other then X or Y. To make the third search, I created the following search; Queue = 'foo' AND CF.{bar} != 'X' AND CF.[bar] != 'Y' AND ( Status = 'new' OR Status = 'open' OR Status = 'stalled' ) However, tickets marked with either X or Y are still appearing in the result. The same result was returned if i changed != to "NOT LIKE", and if I removed either the X or Y part. Is this a bug, is there something wrong with our RT instance or is there something I've overlooked? The operator 'IS' works fine, but it would be nice if I didn't have to change a query each time I updated a Custom Field.. Best regards, Thomas Oddsund SDS/USIT University of Oslo - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Los Angeles - January 9-11 2017
Re: [rt-users] Deleting one attachment
?Hello, Sorry for not seeing this sooner, but I'll leave this for people wondering about the same in the future. We have sucessfully deleted single attachments from a ticket using rt-shredder. Issue the command like this; rt-shredder --plugin 'Objects=Attachment,?' We use RT 4.2.8. Med vennlig hilsen, Thomas Oddsund SDS/USIT Fra: rt-users <rt-users-boun...@lists.bestpractical.com> på vegne av Ram <ram0...@gmail.com> Sendt: 25. oktober 2016 01:45 Til: rt-users Emne: Re: [rt-users] Deleting one attachment Inline.. > A user at work added an attachment that violates corporate policy to a > ticket; the ticket itself is valid and must be kept. I need to delete the > attachment. A quick look at the rt-shredder tool does not make it apparent > to me how to do this with rt-shredder. I can readily do it editing the db in > mysql but I'd rather use rt-shredder if it will do the job. > any help? I'll be going with a direct DB edit which I'm documenting here for the next person. Since I just want to suppress the file and do not want to hide the fact that it existed. Here is what I did, be very careful! If you don't know SQL or you don't understand every step below then find someone else to help you - this is the WRONG PATH for you: 1 Get the attachment id of the attachment to remove (as of RT 4.4.1 it's the *second* number in the URL that displays the attachment). 2 Add a comment to the ticket indicating that you are deleting the offending attachment for policy violation (or whatever you motive). 3 Run this command to improve your odds of not messing up and deleting the wrong transaction: > select id, Transactionid, MessageId, Subject, Filename, ContentType, > ContentEncoding, Headers, Creator, Created from Attachments where id= > ATTACHMENT_ID_FROM_STEP_1 \G 4 If that looks right to you then run this SQL against A TEST COPY OF YOUR DB to ensure you are killing the right attachment > update Attachments set Content = NULL where id = ATTACHMENT_ID_FROM_STEP_1 > limit 1; 5 Go look at the ticket in RT and ensure that you did indeed eliminate the offending attachment. 6 Repeat steps 3,4,5 in your production environment. 7 Do not call me if you shot yourself in the foot. No warranty expressed or implied! If this isn't perfectly clear, hire Best Practical (https://bestpractical.com/) to do it for you. cheers, Ram - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] Downloading attachments via REST
Hello, I am currently in the process of writing a script for simple transferring of tickets from one instance to another. Both instances run 4.2.8, and I'm using Python for the script. Unfortunately, I have met a problem when it comes to attachments. The script uses the requests-library, and rt_get is just a wrapper around the session.get() function. Text files seem fine, but other files(i.e. pdf) aren't stored correctly. >From what I've gathered, even though the Content-Transfer-Encoding says >base64, this is not the case, as base64.decoding outputs a 98 byte file. It's >not correct to output it as utf-8 encoded either, because that gives a file of >475957 bytes. The original file is 236633 bytes. Also, decoding/encoding the >string buffer as Latin-1 throws an error. Have anyone done this before? Is the problem that the pdf file has some other encoding then UTF-8/Latin-1? Will this be different from all files? Are there any ways to just treat the content-response as bits and bytes, and write them directly to a file? A simple example of the code can be seen below, and all kinds of decode/encode attempts have been resultless. #!/usr/bin/env python2 from __future__ import print_function import requests import getpass import re import base64 from rtrequestlib import rt_get, rt_post # Fix Python 2.x. try: input = raw_input except NameError: pass fromSess = requests.Session() fromBase = "https://rt.uio.no/REST/1.0/; username = input("Username: ") password = getpass.getpass() payload = {"user": username, "pass": password} loginS = rt_post(fromSess, fromBase, "", payload) attHead = rt_get(fromSess, fromBase, "ticket/2305592/attachments/26780830/content") # PDF attachment to a ticket # Remove REST-response and last three newlines pdfFile = attHead.text[17:-3] with open("test1.pdf", "wb") as f: f.write(pdfFile.encode("utf-8")) # only 98 bytes with open("test64.pdf", "wb") as f: f.write(base64.decodestring(pdfFile.encode("utf-8"))) with open("test2.pdf", "wb") as f: f.write(pdfFile.encode("iso-8859-1")) # THROWS UnicodeEncodeError Med vennlig hilsen, Thomas Oddsund SDS/USIT - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Conversation grouping by ticket in Outlook / Thread-Index & Thread-Topic
Hello, You can set headers in mail, just add them at the top of your template used for sending, so something like this: --- Start of template --- thread-topic: [rt.example.com #{$Ticket->id}] {$Ticket->Subject} thread-index: *However you choose to set it* {$Transaction->Content()} --- End of template --- Also, keep whatever other headers you have. The easiest would be to just add them at the top of the template and keep the existing lines. How you set the thread-index variable however, that I can't help you with. Med vennlig hilsen, Thomas Oddsund SDS/USIT Fra: rt-users <rt-users-boun...@lists.bestpractical.com> på vegne av L B <bertig...@gmail.com> Sendt: 31. august 2016 15:10 Til: rt-users Emne: [rt-users] Conversation grouping by ticket in Outlook / Thread-Index & Thread-Topic Hi, Can RT send the Thread-Index & Thread-Topic fields as email headers? They are used for grouping conversations in Outlook and avoid seeing each emails of a same ticket in single conversations. I saw here some email dumps with these fields: http://lists.bestpractical.com/pipermail/rt-devel/2008-November/010323.html [...] Content-Transfer-Encoding: base64 thread-topic: [rt.example.com<http://rt.example.com> #1234] Bitte um Rückruf am Mittwoch thread-index: AclI3xNq4KwWEYT8QX+ziU8EtI/A4g== MIME-Version: 1.0 (iPhone Mail 5F136) [...] but I couldn't find anything in RT Core or plugins/extensions to do this. Am I missing something? Thanks! -- L.B. - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Change ticket queue without SeeQueue
Hello, In our RT-instance the group "Everyone" has the following three rights on almost all queues: CreateTicket, ReplyToTicket, SeeQueue. Some experimenting points to the following: CreateTicket is the only one needed to move a ticket from queue A to queue B. The only problem being that queue B won't show up in the list of queues, and for the user it will appear as though they moved a ticket from queue A to blank. SeeQueue only grants access to see that there is indeed a queue called B. So, if users in queue A knows the name of queue B, and can write it correctly in the queue-field in a ticket, you only need to grant everyone "CreateTicket". If they need to see the name of queue B as well, grant everyone "SeeQueue" as well. The right "ShowTicket" seems to be where the magic is, in terms of users being able to view a specific ticket or any ticket in a queue. Best regards, Thomas Oddsund SDS/USIT University of Oslo Fra: rt-users <rt-users-boun...@lists.bestpractical.com> på vegne av Nicholas Adams <nick.adams...@gmail.com> Sendt: 18. august 2016 18:44 Til: pathiaki2 via rt-users Emne: [rt-users] Change ticket queue without SeeQueue Hello, Working on some permissions I am attempting to allow a user to move a ticket from their queue to another queue. They have full general rights on queue A and I would like as few rights as possible on queue B. To make this possible I had to enable SeeQueue on queue B for the group the user is in. Is there a way to not allow the user to view the queue but still allow the user to move the New unowned ticket from queue A to queue B? Thanks, Nick - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Los Angeles - September 12-14, 2016 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017