John Pereira
couple of questions :
Are there any more response types other than "acknowledge" and "reject" and what are their uses.
can we allow users to add notes to an alert when they "acknowledge" or "reject" or any response to an alert.
0
Comments
Please sign in to leave a comment.
There are more response types as they are configurable. I guess you'd have to give more information on "response types for what".
Users can add notes to alerts they respond to. The easiest way is by using the mobile app (assuming you have xMatters On Demand). When you responded via the app, you're pompted if you want to "respond with comments". Here's a good page on it (search for "respond with comment") [https://support.xmatters.com/hc/en-us/articles/202994865-Fall-2014-Release-Overview].
You can do the same with email, but it's more manual (info towards the bottom): https://help.xmatters.com/ondemand/content/userguide/receivingalerts/respondviaemail.htm
John, Andrew has some good info here, but I think you guys are on premise and not on demand, so the answer will be a little different. In the on premise product, the response options are kept in the $content.choices variable that is typically populated in the initial script. As for adding notes, this is a feature we call "annotations". In the response.handler script you should see some parsing of the "rest" of a response to populate an "annotation" variable.
I hope that helps.
Hi Travis, do you have an example that i can refer with..
Not just handy, I can probably get one tomorrow or so. You can also download an integration that uses those action scripts, such as the ServiceNow 2.0 integration or the older Remedy integrations. Those are pretty "advanced" and will have a lot of examples of code usage.
Travis, Any chance you got an example for me for adding notes to an alert when they acknowledge /reject..
Hi Travis, waiting for an example which i can refer to make this work..
email response with text..
also when we respond to the email with certain text, will the text be part of the alert going ahead.
This is from the ServiceNow 2.0 action scripts.
In the Handler > Response script, there is a section that tests if a response was received:
The getActionTokenAndAnnotationText subroutine. Notice the
$annotationText
variable below.Let's try that again....
This is from the ServiceNow 2.0 action scripts.
In the Handler > Response script, there is a section that tests if a response was received:
The getActionTokenAndAnnotationText subroutine. Notice the
$annotationText
variable below.And hopefully one more time:
This is from the ServiceNow 2.0 action scripts.
In the Handler > Response script, there is a section that tests if a response was received:
ELSE-IF ( $responseEvent == "RECEIVED_RESPONSE" )
# Build the list of valid responses, extract the response command and annotation from the
# reply text, then do the actual response processing.
CALL buildUserResponseMap
GOSUB getActionTokenAndAnnotationText
CALL processUserResponse
The getActionTokenAndAnnotationText subroutine. Notice the
$annotationText
variable below.==============================================================================================
getActionTokenAndAnnotationText
#
Iterate over the userResponseMap and see if the start of the reply from the user corresponds
to any of the responses we're expecting. If we find something, extract the annotation, if found.
#
Input: $userResponseMap, $responseTokens
Output: $actionToken, $annotationText
==============================================================================================
getActionTokenAndAnnotationText:
-------------------------- getActionTokenAndAnnotationText -----------------------------------
$actionToken = ""
Set up to parse the user response
$responseTokens = $response.reply
$responseTokens::trim()
$responseTokens::toLowerCase()
@userResponseMap::clearIterator()
$hasNext = @userResponseMap::hasNext()
WHILE( $hasNext && ($actionToken == "") )
@entry = @userResponseMap::getNext()
$key = @entry::getKey()
$key::toLowerCase()
$value = @entry::getValue()
$log_message = "Map entry = [" & $key & ", " & $value & "], responseTokens = [" & $responseTokens & "]"
GOSUB logMessageNote
$keyMatches = $responseTokens::startsWith($key)
IF ($keyMatches)
$matchedToken = $key
$actionToken = $value
ENDIF
$hasNext = @userResponseMap::hasNext()
ENDWHILE
IF ($actionToken != "")
# -------------------------- Found a valid action token -----------------------------------
# Any part of the response beyond what we matched against is an annotation.
$matchedTokenLength = $matchedToken::length()
$responseTokensLength = $response.reply::length()
IF ($responseTokensLength > $matchedTokenLength)
$annotationText = $response.reply::substring( $matchedTokenLength + 1 )
$annotationText::trim()
ENDIF
ENDIF
$log_message = "actionToken = [" & $actionToken & "], annotationText = [" & $annotationText & "]"
GOSUB logMessageNote
RETURN
More test posting sorry guys....
ELSE-IF ( $responseEvent == "RECEIVED_RESPONSE" )
# Build the list of valid responses, extract the response command and annotation from the
# reply text, then do the actual response processing.
CALL buildUserResponseMap
GOSUB getActionTokenAndAnnotationText
CALL processUserResponse
Travis, thank you. ill check this out..