Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

How do I find out if the message is the first in the ticket?

Hi guys

I am currently making a trigger on the "New message on request" event that sets a status when there is a new message. However, I need to make sure that this doesn't happen when the message is the first one in the ticket.

What is the quickest way to determine if the message is the first one? I know every message has an id (ej_message.id), but I think using that would require me to use the SearchEngine to figure out if the message is the lowest on the ticket which not would not be feasible performance wise.

Espen
CRM Insight

RE: How do I find out if the message is the first in the ticket?

Hi,

It should be possible to perform check against field on Ticket, something like this :

Ticket ticket;
ticket.load(getVariable("ticketId").toInteger());

Integer num = ticket.getValue("numMessages").toInteger();
if(num > 1)
{
 //Old ticket do your Status magic here
}
Von: Michel Krohn-Dale 16. Jun 2020

RE: How do I find out if the message is the first in the ticket?

Ah! That's exactly what I was looking for. I didn't realise there was such a field on the ticket table. Thank you!

Von: Espen Steen 16. Jun 2020