keep status by new mesage to closed ticket

Hi,

In SO standart-Routine, if customer replied to a closed ticket, then ticket will be automatically reopend or new ticket created depending on what we set in Category for new message.

from certain reasons, we don't like this automatism. Is ist possible to keep status closed and no new ticket?

I have scripts to keep Status:

String oldStatus = getParserVariable("ticket.old.status");
String newStatus = getParserVariable("ticket.new.status");
String oldTicketStatus = getParserVariable("ticket.old.ticketStatus");
String newTicketStatus = getParserVariable("ticket.new.ticketStatus");
if (oldStatus == "2" && newStatus != "2") { //reopened request
t.setValue("ticketStatus", oldTicketStatus);
t.save();
}

But if I set it in trigger "Saving requests", then all closed tickets cannot be manually reopend no matter new message incoming, or if I set in Trigger "Request reopend from email", then it doesn't works, Status Nevertheless go back to open.

RE: keep status by new mesage to closed ticket

Hi,

any Feedbacks?

 

my target is, after Customer reply to closed ticket, it should be nothing changed in its status (keep closed), and no new ticket. We decide by self (not by Customer) which Status it should be in diff. cases.

- customer replied with "Thank you", nothing changed with status;

- customer replied with not solved Problem yet, we change Status to open by self;

-customer replied with other new request, we split the last message in new ticket.

The default automatism does not cover this 3 cases.

And all closed Tickets will be billed to customer per each Month, therefore the Status is importent for us and our customer.

By: Jianchun You 22 Sep 2020

RE: keep status by new mesage to closed ticket

Hi,

If you extend your code in Ticket.save to check if any message has been created I would think you should be able to fit your scenarios.

Perhaps something similar to this;

DateTime now;


String oldStatus = getParserVariable("ticket.old.status");
String newStatus = getParserVariable("ticket.new.status");
String oldTicketStatus = getParserVariable("ticket.old.ticketStatus");
String newTicketStatus = getParserVariable("ticket.new.ticketStatus");
if (oldStatus == "2" && newStatus != "2") { //reopened request
  Bool newMessage = false;
  SearchEngine se;

  se.addField("ej_message.created_at");
  se.addCriteria("ej_message.ticket_id", "equals", getVariable("ticketId"), "and", 0);
  se.addCriteria("ej_message.created_by", "equals", "1");
  se.addOrder("ej_message.created_at", false);
  se.setLimit(1);

  se.execute();
  if (!se.eof())
  {
    if (now.diff(se.getField(0).toDateTime()) < 30) // if message added in the last 30 seconds, we probably have a new message
      newMessage = true;
  }
  if(newMessage)
  {
    Ticket t;
    t.load(getVariable("ticketId").toInteger());
    t.setValue("ticketStatus", oldTicketStatus);
    t.save();
  }
}

For Trigger "Request reopened from email" this is triggering after status is already changed.

By: Michel Krohn-Dale 22 Sep 2020

RE: keep status by new mesage to closed ticket

Hi Michel,

 

good idea to check createTime of last Message with curren time in X Second.

I will try it.

 

Thanks!

By: Jianchun You 22 Sep 2020

RE: keep status by new mesage to closed ticket

HI Michel,

I have tried your code. But the last section to t.save() was not be hit, the Bool newMessage keep still false. The last message is not the one which customer relied to closed ticket, but the one before.

the time to t.save() is earlierer then the Trigger of saving a request, at this time the last message of customer reply can not be caught.

I think here is no solution to match my cases. But thanks nevertheless for your effort.

 

By: Jianchun You 23 Sep 2020

RE: keep status by new mesage to closed ticket

Hi,

You might need to fiddle a bit with the criterias and time to see if you get it to work. For me this worked during testing, but might be that you have some other triggers as well. Remember that this trigger will fire everytime you perform t.save()

By: Michel Krohn-Dale 23 Sep 2020

RE: keep status by new mesage to closed ticket

HI Michel,

 

it works now. Problem is, I must load ticket again as you do,

t.load(ticketId.toInteger());

then I catch the last messsage from customer reply to closed ticket.

Thanks for many times!

By: Jianchun You 24 Sep 2020

RE: keep status by new mesage to closed ticket

Hi,

I am looking at this solution as well as a customer wanted the exact same functionality. But I can't even get the statuses. When tracing the trigger script, the status variables are blank as a ticket is changed from closed (2) to active again by replying to an email as "customer".

What have I possibly missed?

By: Patrik Larsson 11 May 2021

RE: keep status by new mesage to closed ticket

Hi Patrick,

Could you please tell me which trigger you are using? My example was based on using Ticket.save trigger.

By: Michel Krohn-Dale 11 May 2021

RE: keep status by new mesage to closed ticket

Am using the trigger "Request reopened from email" as mentioned in the thread.

By: Patrik Larsson 11 May 2021

RE: keep status by new mesage to closed ticket

Hi,

Dont believe this trigger is suited for this scenario as it happens after status has already changed. Should be possible with using what I suggested earlier in this post.

By: Michel Krohn-Dale 11 May 2021