Auto-close Chat interaction records

Akansha Gupta
Mega Sage

Hi All,

I am facing an issue where Interaction records of type=Chat are not getting auto closed in below scenario:

1. User starts the chat; in backend Interaction record get created

2. Before user select any option, he closes the window - interaction records always stays in WIP state

 

I thought OOB this must be taken care through some job, but the interaction record for Live Chat are always in WIP state.

 

Can some help please help in confirming the behavior and resolving the issue.

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Akansha Gupta 

In that case you will have to come up with a custom solution to close that.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  - thanks for the response!

By any chance, do you know if that's expected behavior ?

@Akansha Gupta 

check this KB
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0963514 

there is this scheduled job "Fallback Timeout for interactions in Wrap Up" which wraps up the Interaction.

AnkurBawiskar_0-1753261239254.png

 

For your requirement you can create a custom scheduled job

Look for target Interaction records of type Chat left in WIP for more than a set time limit (e.g., 1 hour). The script would update them to a closed state if they have not progressed

var gr = new GlideRecord('interaction');
gr.addQuery('type', 'Chat');
gr.addQuery('state', 'WIP'); // or the numeric equivalent
gr.addQuery('sys_updated_on', '<', gs.minutesAgo(60)); // adjust time/window as needed
gr.query();
while (gr.next()) {
    gr.state = 'closed_complete'; // or another appropriate closed state
    gr.update();
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Akansha Gupta 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader