Question

Bot Conditions - Else statement not working

  • 31 October 2023
  • 1 reply
  • 38 views

Hello, 

I am quite new to bot building so I hope someone can help.

I have created a flow where a reference number is collected. This has the following regex validation applied:

(700000[0-9]|70000[1-9][0-9]|7000[1-9][0-9]{2}|700[1-9][0-9]{3}|70[1-9][0-9]{4}|7[1-9][0-9]{5}|[89][0-9]{6})

I have then created a condition where if the response is valid you to go dialogue 12.2, else dialogue 12.4.

Where a valid reference number is entered this works as intended, however if something else is entered this is not going to 12.4, instead it is just asking for the reference again (12.1) leaving you stuck in a cycle.

Is there something I have done wrong? How can a you get out of this cycle without entering a valid reference?

 


1 reply

Hi Kerris, 

If the regex match fails, the current behaviour is that the dialog gets repeated due to which condition is not getting executed. 

In order to handle your current use-case, I would recommend creating a custom functions to return a flag and identify if the reference ID matches the expected output. Based on the output, conditions can be configured. 

Here is a solution article on custom function: https://crmsupport.freshworks.com/en/support/solutions/articles/50000004647-using-custom-javascript-functions-with-bots?cloud=freshchat

Reply