Skip to content

Commit fe3b963

Browse files
authored
Cancel struck slack conversations (#2592)
* Add script to display user mentions in Service Portal This script retrieves and displays the top 5 records where the logged-in user is mentioned, providing links to those records. * Delete Modern Development/Service Portal Widgets/My Mentioned Items directory * Create script.js * Delete Modern Development/Service Portal Widgets/My Mentioned Items directory * Create script.js * Delete Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles directory * Create script.js * Create README.md * Update README.md * Update script.js * Update and rename README.md to README.md * Update README.md * Create script.js * Delete Specialized Areas/Fix scripts/Cacel Struck Slack Conversations directory
1 parent 43270e1 commit fe3b963

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**Use Case**
2+
1. Sometimes due to network or connecton issue, users are not able to end the conversations using **restart** or **end** command from slack.
3+
2. This script will cancel the struck slack conversations, allowing the users to interaction with ServiceNow again through slack.
4+
3. The encoded Query device type specify the source of conversation.
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)