Change CF with HTTP

Hello,

is it possible to change a CF with a http command like
http://$ipaddress/rt/Modify.html?id=;CF=;CFval=
?

Thank you in advice

Best regards
Bernhard

Hi Vinzenz,

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

I think I have a URL like this:
http:///REST/1.0/ticket//edit…

but how do I change a CF?

I already tried
http:///REST/1.0/ticket//edit?CF.{}:<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}:<CFvalue>

and
http:///REST/1.0/ticket//edit?CF.{}=<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}=<CFvalue>

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
BernhardVon: Sinapius, Vinzenz [mailto:Vinzenz.Sinapius@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@tracetronic.demailto:vinzenz.sinapius@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@lists.bestpractical.com] Im Auftrag von Eierschmalz, Bernhard
Gesendet: Dienstag, 12. April 2016 14:58
An: rt-users@lists.bestpractical.commailto:rt-users@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=;CF=;CFval=<customfield-valuehttp://$ipaddress/rt/Modify.html?id=<ticketno>;CF=<customfield-ID>;CFval=<customfield-value>
?

Thank you in advice

Best regards
Bernhard

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:
,,,,,…
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
BernhardVon: Sinapius, Vinzenz [mailto:Vinzenz.Sinapius@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 querystringshttps://en.wikipedia.org/wiki/Query_string. For the REST-API you need to put key-value-pairs in the body of a POST Requesthttps://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@tracetronic.demailto:vinzenz.sinapius@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@scheppach.com]
Gesendet: Mittwoch, 13. April 2016 08:16
An: Sinapius, Vinzenz <Vinzenz.Sinapius@tracetronic.demailto:Vinzenz.Sinapius@tracetronic.de>
Cc: rt-users@lists.bestpractical.commailto:rt-users@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:///REST/1.0/ticket//edithttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit

but how do I change a CF?

I already tried
http:///REST/1.0/ticket//edit?CF.{}:<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}:<CFvalue>

and
http:///REST/1.0/ticket//edit?CF.{}=<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}=<CFvalue>

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@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@tracetronic.demailto:vinzenz.sinapius@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@lists.bestpractical.com] Im Auftrag von Eierschmalz, Bernhard
Gesendet: Dienstag, 12. April 2016 14:58
An: rt-users@lists.bestpractical.commailto:rt-users@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=;CF=;CFval=<customfield-valuehttp://$ipaddress/rt/Modify.html?id=<ticketno>;CF=<customfield-ID>;CFval=<customfield-value>
?

Thank you in advice

Best regards
Bernhard

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 :wink: 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@tracetronic.demailto:vinzenz.sinapius@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 086Von: Eierschmalz, Bernhard [mailto:Bernhard.Eierschmalz@scheppach.com]
Gesendet: Mittwoch, 13. April 2016 11:54
An: Sinapius, Vinzenz Vinzenz.Sinapius@tracetronic.de
Cc: rt-users@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:
,,,,,…
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@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 querystringshttps://en.wikipedia.org/wiki/Query_string. For the REST-API you need to put key-value-pairs in the body of a POST Requesthttps://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@tracetronic.demailto:vinzenz.sinapius@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@scheppach.com]
Gesendet: Mittwoch, 13. April 2016 08:16
An: Sinapius, Vinzenz <Vinzenz.Sinapius@tracetronic.demailto:Vinzenz.Sinapius@tracetronic.de>
Cc: rt-users@lists.bestpractical.commailto:rt-users@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:///REST/1.0/ticket//edithttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit

but how do I change a CF?

I already tried
http:///REST/1.0/ticket//edit?CF.{}:<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}:<CFvalue>

and
http:///REST/1.0/ticket//edit?CF.{}=<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}=<CFvalue>

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@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@tracetronic.demailto:vinzenz.sinapius@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@lists.bestpractical.com] Im Auftrag von Eierschmalz, Bernhard
Gesendet: Dienstag, 12. April 2016 14:58
An: rt-users@lists.bestpractical.commailto:rt-users@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=;CF=;CFval=<customfield-valuehttp://$ipaddress/rt/Modify.html?id=<ticketno>;CF=<customfield-ID>;CFval=<customfield-value>
?

Thank you in advice

Best regards
Bernhard

Row (4.94 KB)

Hi Bernhard,

I did it like this:

[cid:image005.png@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@tracetronic.demailto:vinzenz.sinapius@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 086Von: Eierschmalz, Bernhard [mailto:Bernhard.Eierschmalz@scheppach.com]
Gesendet: Mittwoch, 13. April 2016 13:33
An: Sinapius, Vinzenz Vinzenz.Sinapius@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@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@01D195A5.D1E93880]

Best Regards
Bernhard

Von: Sinapius, Vinzenz [mailto:Vinzenz.Sinapius@tracetronic.de]
Gesendet: Mittwoch, 13. April 2016 13:06
An: Eierschmalz, Bernhard
Cc: rt-users@lists.bestpractical.commailto:rt-users@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 :wink: 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@tracetronic.demailto:vinzenz.sinapius@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@scheppach.com]
Gesendet: Mittwoch, 13. April 2016 11:54
An: Sinapius, Vinzenz <Vinzenz.Sinapius@tracetronic.demailto:Vinzenz.Sinapius@tracetronic.de>
Cc: rt-users@lists.bestpractical.commailto:rt-users@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:
,,,,,…
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@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 querystringshttps://en.wikipedia.org/wiki/Query_string. For the REST-API you need to put key-value-pairs in the body of a POST Requesthttps://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@tracetronic.demailto:vinzenz.sinapius@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@scheppach.com]
Gesendet: Mittwoch, 13. April 2016 08:16
An: Sinapius, Vinzenz <Vinzenz.Sinapius@tracetronic.demailto:Vinzenz.Sinapius@tracetronic.de>
Cc: rt-users@lists.bestpractical.commailto:rt-users@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:///REST/1.0/ticket//edithttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit

but how do I change a CF?

I already tried
http:///REST/1.0/ticket//edit?CF.{}:<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}:<CFvalue>

and
http:///REST/1.0/ticket//edit?CF.{}=<CFvaluehttp://<ticketserver>/REST/1.0/ticket/<ticketno>/edit?CF.{<CFname>}=<CFvalue>

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@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@tracetronic.demailto:vinzenz.sinapius@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@lists.bestpractical.com] Im Auftrag von Eierschmalz, Bernhard
Gesendet: Dienstag, 12. April 2016 14:58
An: rt-users@lists.bestpractical.commailto:rt-users@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=;CF=;CFval=<customfield-valuehttp://$ipaddress/rt/Modify.html?id=<ticketno>;CF=<customfield-ID>;CFval=<customfield-value>
?

Thank you in advice

Best regards
Bernhard