- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 06:56 AM
Hi Team,
I assume this is pretty straight forward to configure via a Business Rule, also would it be an Insert/Update Business Rule?
What would be required to configure a simple Business Rule, that auto-closes any Interaction, after one hour (60 mins) of that Interaction having been opened, provided the Interaction has not been Updated within that hour.
Many thanks for the guidance/advice.
I am looking to configure this on my PDI.
Kind Regard, Warwick
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 09:42 AM
I don't think a Business Rule would work here as it would need to run on an update of a record, and your use case is actually about lack of updates 🙂
So I would suggest creating a scheduled job instead (sysauto_script):
Set it to Run: Periodically, let's say every 10 minutes ( I would advise against running it too frequently).
Set the script to something like this:
var closeInterval = '60'; // in minutes <-- replace this hard coded value with a system property!
function abandonedIntractions(time) {
var interactionToClose = new GlideRecord('interaction');
interactionToClose.addEncodedQuery('active=true^sys_updated_onRELATIVELT@minute@ago@' + time);
interactionToClose.setValue('state', 5); // 5 = Close abandoned
interactionToClose.updateMultiple();
}
abandonedIntractions(closeInterval);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 03:10 PM - edited ‎05-15-2023 03:13 PM
Hi,
You can add "^interaction_type='Phone'" to the query Laszlo provided, like:
interactionToClose.addEncodedQuery('active=true^sys_updated_onRELATIVELT@minute@ago@' + time + '^interaction_type=Phone');
You must use the field name and value for "Interaction Type = Phone". If the Interaction Type field is a choice field, then the value for "Phone" would be needed in the query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 09:42 AM
I don't think a Business Rule would work here as it would need to run on an update of a record, and your use case is actually about lack of updates 🙂
So I would suggest creating a scheduled job instead (sysauto_script):
Set it to Run: Periodically, let's say every 10 minutes ( I would advise against running it too frequently).
Set the script to something like this:
var closeInterval = '60'; // in minutes <-- replace this hard coded value with a system property!
function abandonedIntractions(time) {
var interactionToClose = new GlideRecord('interaction');
interactionToClose.addEncodedQuery('active=true^sys_updated_onRELATIVELT@minute@ago@' + time);
interactionToClose.setValue('state', 5); // 5 = Close abandoned
interactionToClose.updateMultiple();
}
abandonedIntractions(closeInterval);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 02:41 PM
Hi Laszlo,
Thanks ever so much, I am trying this solution and it is working, it is great.
Can I just ask one more clarification please, then your script will work perfectly for me.
How can I use the exact script you have above, but also add a Condition or line item that also ensures this script only runs, for when Interaction Type = 'Phone'. ?
So I basically need this exact script above to run, via the scheduled job, so long as the Interaction Type = Phone.
Thanks ever so much for your guidance.
Kind Regards,
Warwick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 03:10 PM - edited ‎05-15-2023 03:13 PM
Hi,
You can add "^interaction_type='Phone'" to the query Laszlo provided, like:
interactionToClose.addEncodedQuery('active=true^sys_updated_onRELATIVELT@minute@ago@' + time + '^interaction_type=Phone');
You must use the field name and value for "Interaction Type = Phone". If the Interaction Type field is a choice field, then the value for "Phone" would be needed in the query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 03:15 PM
Hi Bert,
thanks very much for that clarification, that works perfectly, I appreciate your help.
kind Regards,
Warwick