Trigger actions based off key word in open-end comment? | XM Community
Solved

Trigger actions based off key word in open-end comment?

  • 25 July 2018
  • 6 replies
  • 42 views

Userlevel 2
Badge +6
I'm trying to only trigger an action/e-mail when a respondent includes a specific word in their open-end comment. For this specific use case the word(s) I'm looking to have the e-mail triggered off of is 'app' and/or 'apps'. The problem I'm running into is that I'm also getting alerts when a word like 'apply' is in the text - which is not what I want. I was told to use 'matches regex' but that still does not seem to be working. Any suggestions on how to get this functionality to work? I've added a screen shot of what it currently looks like, which is not working.!
icon

Best answer by mattyb513 26 July 2018, 01:25

View original

6 replies

Userlevel 7
Badge +20
You can try using logic "contains" and find word " app " or " apps " (add a space before and after "app" or "apps")
Userlevel 6
Badge +6
Why not just put spaces around the word you are looking for? Then you could even just use a Contains argument
Userlevel 2
Badge +6
When I try adding a space before/after the word and the 'contains' logic, an e-mail is still triggered for the word 'application'. What I'm hoping to do is only get the e-mail to trigger if a specific word is included in the comment, and not trigger if another word has the same letter configuration.
Userlevel 6
Badge +6
Hmm, let me test it. It’s probably stripping the spaces
Userlevel 6
Badge +6
Regex should work better actually. Without regex you'll miss if they use it at the beginning or end of the sentence:

`/(\\ |^)(apps|app)(\\ |[[:punct:]]|$)/gim`

This checks to ensure that immediately before `app` is either a space or the beginning of a word. It then checks that either `app` or `apps` is present, and that immediately following those are either puncuation, a space, or the end of the phrase. It is also case insensitive.
Userlevel 2
Badge +6
Thanks mattyb513, that seems to work. Thanks for sharing your wisdom with a new user.

Leave a Reply