[rt-users] Change CF with HTTP

Sinapius, Vinzenz Vinzenz.Sinapius at tracetronic.de
Wed Apr 13 07:06:05 EDT 2016


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>
Cc: 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/f29d17c0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: easyedit.PNG
Type: image/png
Size: 10732 bytes
Desc: easyedit.PNG
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160413/f29d17c0/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Row
Type: application/octet-stream
Size: 5058 bytes
Desc: Row
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160413/f29d17c0/attachment.obj>


More information about the rt-users mailing list