Status log (ticket_log_change) and status names

Hi,

I'm making a short version of the log so that user can see who and when a status changed for a request but I'm not able to pull the name from ticket_status, should I make an additional SearchEngine for this?

 

Integer s_ticketId = 6995;

  SearchEngine se;
se.addField("ticket_log_change.action_id.log_when");
// se.addField("ticket_log_change.(ticket_status->id).name"); //Test
se.addField("ticket_log_change.from_value");
se.addField("ticket_log_change.to_value");
se.addCriteria("ticket_log_change.log_change", "OperatorEquals", "35"); // 35 = change status
se.addCriteria("ticket_log_change.ticket_id", "OperatorEquals", s_ticketId.toString());
se.addOrder("ticket_log_change.action_id.log_when", true);
//print(se.buildSql());
se.execute();
for(;!se.eof();se.next()){
print("From status: " + se.getField("ticket_log_change.from_value") + " To Status: " + se.getField("ticket_log_change.to_value") + "\n");

Made a test above but it won't work.

Suggestions?

RE: Status log (ticket_log_change) and status names

Hi,

There exists a shorter version of Log, accessible with URL: ticket.fcgi?_sf=0&action=listTicketLog&ticketId=<ticketId>, have you seen if this can solve your issue?

If not it is not possible to do any join from ticket_log_change against ticket_status table, and you would need to perhaps load Map with values from ticket_status table once in your screen, and simply perform lookup.

By: Michel Krohn-Dale 16 Mar 2020