How can I capture a keyword in the body of a reply to a ticket?
I’m trying to scan a response to a ticket for the keyword “proceed”. Is there something wrong with the expression I’m using? It works when I use a test case.
However when this runs, it fails to detect the word “proceed”
Logs show the keyword in the response body:
Page 1 / 1
Do you have screen shots of your JSON parser and expression/condition nodes?
As far as I know, the “Expression has failed” messages mean the expression itself failed due to some kind of error, not that it ran successfully and returned false. If you review the execution logs, it should give some detail in there (here’s an example of a condition node of ours with true, false, and failure results)
We use a workflow rule to close resolved tickets if the requester includes #close in their reply.
We trigger the rule when the requester replies or adds a note, then check the ticket.latest_public_comment field. This way we don’t accidentally trigger if we find an older message in the conversation that has the keyword - we only want to check the latest reply (I assume that can be done via API too though).
I wasn’t finding good documentation for the regex system FS uses, so I just converted to lower case and used indexOf instead. Not sure if something like that would work for your use case or not!
Hi @thusep8652
Not sure if you’ve solved your issue or not but here’s what worked for me - very similar to Mike’s solution above.
I’m trying to scan a response to a ticket for the keyword “proceed”. Is there something wrong with the expression I’m using? It works when I use a test case.
My only suggested edit to @mike.b would be to set the Expected Output = Number and to remove the >-1 because that’s going to need an IF stmt to make use of it.
This will return the position of “proceed” in the field - if there are none it will return -1 as the result.
However, it won’t be able to differentiate “Proceed” from “Do not proceed”
Using a hash to identify an action word like Mike B is suggesting will help keep the WF from running inappropriately - especially if the action email is coming from internal or someone you can work with to mod the contents.
HTH
Bryn @ CYDEF.ca
My only suggested edit to @mike.b would be to set the Expected Output = Number and to remove the >-1 because that’s going to need an IF stmt to make use of it.
Since the expression is part of a condition node it’s expecting a boolean output, so that’s why the `> -1` part.
Even though it says it’s expecting a string in the screenshot… I think that’s just a Freshservice quirk, it won’t actually let you change it for a condition node.
But yeah, if you were in a normal expression node, then the setup as pictured wouldn’t work!
Yeah I noticed that restriction too when using an expression in the WF condition node.
It took me a moment to realize you don’t need to build an IF] stmt in Boolean mode bc that setting is just attempting to assess the whatever statement you’ve entered as either T or F.