[rt-users] Change CF with HTTP

Sinapius, Vinzenz Vinzenz.Sinapius at tracetronic.de
Wed Apr 13 11:07:44 EDT 2016


Hi Bernhard,

I did it like this:

[cid:image005.png at 01D195A6.FE9655B0]

Include a custom js file in the RT_SiteConfig.pm:

Set(@JSFiles, qw/
tt_custom.js
/);

In tt_custom.js I get all EasyEdit-elements with jquery and replace it with my buttons.

Unfortunately I don't have the time to implement a solution for your specific problem.  As you see it requires quite some modifications and custom code.

Maybe someone from rt-users nows a better way?

Cheers,
Vinzenz
Vinzenz Sinapius
Information Technology | Informationstechnik

tracetronic GmbH
Stuttgarter Str. 3
01189 DRESDEN
GERMANY

Phone: +49 351 205768-167
Fax: +49 351 205768-999
E-mail: vinzenz.sinapius at tracetronic.de<mailto:vinzenz.sinapius at tracetronic.de>

Head Office | Hauptsitz: Stuttgarter Str. 3, 01189 DRESDEN, GERMANY
Managing Directors | Geschäftsführer: Dr.-Ing. Rocco Deutschmann, Dr.-Ing. Peter Strähle
Registration Court | Registergericht: Amtsgericht Dresden, HRB 23 086


Von: Eierschmalz, Bernhard [mailto:Bernhard.Eierschmalz at scheppach.com]
Gesendet: Mittwoch, 13. April 2016 13:33
An: Sinapius, Vinzenz <Vinzenz.Sinapius at tracetronic.de>
Betreff: AW: Change CF with HTTP

Hi Vinzenz,

I see your result, but I absolutely don't know how to do this.


In the end there should be a list like this: (only with text)
[cid:image003.png at 01D195A5.D1E93880]


Okay, if I change the ..../Row File as you sent to me,
how do I need to write the HTML-code in "format"?
[cid:image004.png at 01D195A5.D1E93880]


Best Regards
Bernhard

Von: Sinapius, Vinzenz [mailto:Vinzenz.Sinapius at tracetronic.de]
Gesendet: Mittwoch, 13. April 2016 13:06
An: Eierschmalz, Bernhard
Cc: rt-users at lists.bestpractical.com<mailto:rt-users at lists.bestpractical.com>
Betreff: AW: Change CF with HTTP

Hi Bernhard,

Yes something like that is possible (see attached image). We needed to modify share/html/Elements/CollectionsAsTable/Row (By overwriting it via the local-Folder) to include the title or key of the shown value in the rendered html. (See attached)

With this modification, we can find the customfield-values in the search-results with a jQuery-Selector: var prio_tds = jQuery('td[data-fieldkey="__Priority__"]');

And then we can do many funny things to these html elements ;) like replacing it with a button and attaching an ajax-call to this button.

Cheers,
Vinzenz
Vinzenz Sinapius
Information Technology | Informationstechnik

tracetronic GmbH
Stuttgarter Str. 3
01189 DRESDEN
GERMANY

Phone: +49 351 205768-167
Fax: +49 351 205768-999
E-mail: vinzenz.sinapius at tracetronic.de<mailto:vinzenz.sinapius at tracetronic.de>

Head Office | Hauptsitz: Stuttgarter Str. 3, 01189 DRESDEN, GERMANY
Managing Directors | Geschäftsführer: Dr.-Ing. Rocco Deutschmann, Dr.-Ing. Peter Strähle
Registration Court | Registergericht: Amtsgericht Dresden, HRB 23 086


Von: Eierschmalz, Bernhard [mailto:Bernhard.Eierschmalz at scheppach.com]
Gesendet: Mittwoch, 13. April 2016 11:54
An: Sinapius, Vinzenz <Vinzenz.Sinapius at tracetronic.de<mailto:Vinzenz.Sinapius at tracetronic.de>>
Cc: rt-users at lists.bestpractical.com<mailto:rt-users at lists.bestpractical.com>
Betreff: AW: Change CF with HTTP

Hi Vinzenz,

thanks so far - I'm not sure if this will work for me.
So let me explain my whole problem, maybe you have a better solution to reach help me.

I have a fax-server wich sends faxes as mail into RT. So the mails are always with the same content and attached there is a PDF-file with the fax-document.
I have one custom field for my queue called "category"
Our staff need to sort the fax-tickets into different categories, using this custom field. (so this team only sorts the tickets - once the ticket is sorted into the category, it will appear in another team to work on the ticket)
In the moment, the "sorting staff" have to open one ticket after another, open the attached pdf-file, change the CF-value and go to the next ticket.
So the colleagues asked me for an easier way.


My idea was the following:
I create one search for all the unsorted faxes. As format I define like the following:
<ticket-ID>,<ticketSubject>,<requestor>,<categoryA>,<categoryB>,...
On the column "CategoryA" there should be a link to change custom field of this ticket to cagetory A, same for the other categories.
The "high-end-solution" would be also to have directly a link to the attached PDF-file from the search - but I don't belive this is possible.


do you think this way will be working? Or do you have another solution for my problem?


Best regards
Bernhard

Von: Sinapius, Vinzenz [mailto:Vinzenz.Sinapius at tracetronic.de]
Gesendet: Mittwoch, 13. April 2016 09:52
An: Eierschmalz, Bernhard
Betreff: AW: Change CF with HTTP

Hi Bernhard,

AFAIK you currently can't update tickets with querystrings<https://en.wikipedia.org/wiki/Query_string>. For the REST-API you need to put key-value-pairs in the body of a POST Request<https://en.wikipedia.org/wiki/POST_(HTTP)>.

You can do this with javascript, here is a function I use in our Instance to update the priority of a ticket. You can use this to build something similar and attach it to a button or something similar.

function set_ticket_prio(priority, ticket_id){
                url = "https://ticketserver/rt/REST/1.0/ticket/__id__/edit".replace('__id__', ticket_id);
                data = 'content=Priority: __prio__'.replace('__prio__', priority);
                jQuery.ajax({type:"POST", url:url, data:data, success: refresh_table});
}

Cheers,
Vinzenz
Vinzenz Sinapius
Information Technology | Informationstechnik

tracetronic GmbH
Stuttgarter Str. 3
01189 DRESDEN
GERMANY

Phone: +49 351 205768-167
Fax: +49 351 205768-999
E-mail: vinzenz.sinapius at tracetronic.de<mailto:vinzenz.sinapius at tracetronic.de>

Head Office | Hauptsitz: Stuttgarter Str. 3, 01189 DRESDEN, GERMANY
Managing Directors | Geschäftsführer: Dr.-Ing. Rocco Deutschmann, Dr.-Ing. Peter Strähle
Registration Court | Registergericht: Amtsgericht Dresden, HRB 23 086


Von: Eierschmalz, Bernhard [mailto:Bernhard.Eierschmalz at scheppach.com]
Gesendet: Mittwoch, 13. April 2016 08:16
An: Sinapius, Vinzenz <Vinzenz.Sinapius at tracetronic.de<mailto:Vinzenz.Sinapius at tracetronic.de>>
Cc: rt-users at lists.bestpractical.com<mailto:rt-users at lists.bestpractical.com>
Betreff: AW: Change CF with HTTP

Hi Vinzenz,

Thanks, but I'm not sure how to do this.

I think I have a URL like this:
http://<ticketserver>/REST/1.0/ticket/<ticketno>/edit<http://%3cticketserver%3e/REST/1.0/ticket/%3cticketno%3e/edit>.....

but how do I change a CF?

I already tried
http://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}:<CFvalue<http://%3cticketserver%3e/REST/1.0/ticket/%3cticketno%3e/edit?CF.%7b%3cCFname%3e%7d:%3cCFvalue>>

and
http://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}=<CFvalue<http://%3cticketserver%3e/REST/1.0/ticket/%3cticketno%3e/edit?CF.%7b%3cCFname%3e%7d=%3cCFvalue>>

both didn't work.

Just to make sure what I want:
I need one URL where a user can click and with opening this URL a CF value is changed.
Will this work with REST?


Best regards
Bernhard


Von: Sinapius, Vinzenz [mailto:Vinzenz.Sinapius at tracetronic.de]
Gesendet: Dienstag, 12. April 2016 16:59
An: Eierschmalz, Bernhard
Betreff: AW: Change CF with HTTP

Hi Bernhard,

You can use wget/curl and the REST-API: http://requesttracker.wikia.com/wiki/REST

Cheers,
Vinzenz
Vinzenz Sinapius
Information Technology | Informationstechnik

tracetronic GmbH
Stuttgarter Str. 3
01189 DRESDEN
GERMANY

Phone: +49 351 205768-167
Fax: +49 351 205768-999
E-mail: vinzenz.sinapius at tracetronic.de<mailto:vinzenz.sinapius at tracetronic.de>

Head Office | Hauptsitz: Stuttgarter Str. 3, 01189 DRESDEN, GERMANY
Managing Directors | Geschäftsführer: Dr.-Ing. Rocco Deutschmann, Dr.-Ing. Peter Strähle
Registration Court | Registergericht: Amtsgericht Dresden, HRB 23 086


Von: rt-users [mailto:rt-users-bounces at lists.bestpractical.com] Im Auftrag von Eierschmalz, Bernhard
Gesendet: Dienstag, 12. April 2016 14:58
An: rt-users at lists.bestpractical.com<mailto:rt-users at lists.bestpractical.com>
Betreff: [rt-users] Change CF with HTTP

Hello,

is it possible to change a CF with a http command like
http://$ipaddress/rt/Modify.html?id=<ticketno>;CF=<customfield-ID>;CFval=<customfield-value<http://$ipaddress/rt/Modify.html?id=%3cticketno%3e;CF=%3ccustomfield-ID%3e;CFval=%3ccustomfield-value>>
?

Thank you in advice

Best regards
Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160413/0bbf6e3c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 26241 bytes
Desc: image003.png
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160413/0bbf6e3c/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 30391 bytes
Desc: image004.png
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160413/0bbf6e3c/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 39405 bytes
Desc: image005.png
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160413/0bbf6e3c/attachment-0002.png>


More information about the rt-users mailing list