Skip to content

Commit c464083

Browse files
authored
Create script.js
1 parent 82a5852 commit c464083

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • Specialized Areas/Fix scripts/Cancel Struck Slack Conversations
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
This script will mark the struck slack conversation as canceled.
3+
Use Case: Sometimes due to n/w or connecton issue, users are not able to end the conversations using restart or end command from slack.
4+
Device Type in Encoded Query specify the source of conversation, slack in this case.
5+
*/
6+
var struckConv = new GlideRecord('sys_cs_conversation'); // conversation table glide record
7+
struckConv.addEncodedQuery('stateINopen,faulted,chatInProgress^device_type=slack'); // Query can be enhanced based on user (consumer) or date range.
8+
struckConv.query();
9+
while(struckConv.next()){
10+
struckConv.setValue('state','canceled'); // set the state to cancel for struck conversation.
11+
struckConv.setWorkflow(false);
12+
struckConv.update();
13+
}

0 commit comments

Comments
 (0)