0

I have two Entity types (@name and @ surname) . If the customer can enter these two parameters I will send the flow to another page. is it possible can I do this with conditional response?

I wrote a simple code like below but It does not work. I get "true" as output even if I don't enter my surname

if ($session.params.name! = " ") OR ($session.params.surname != " ")
      'true'
    else
      'false'
    endif

Thank you.

Krish
  • 752
  • 3
  • 10
Ceyhun Tekin
  • 103
  • 1
  • 11

2 Answers2

2

Yes, you can accomplish this by creating a route with a condition.

https://cloud.google.com/dialogflow/cx/docs/concept/handler#route

https://cloud.google.com/dialogflow/cx/docs/concept/handler#cond

A route may include an intent and/or a condition. The CX UI includes this feature as well as boolean logic to help achieve your desired outcome. Example condition using user defined session parameters

Then you can define the fulfillment and transition as needed.

peanut
  • 61
  • 2
  • It is helpful to summarize the important details in your answer with external links being citations as Stackoverflow answers might last longer than links. – user904963 Dec 10 '21 at 20:29
0

I think if you are not entering anything, the parameter will resolve as 'null', hence, also not " ". I would do it this way.

if $session.params.name! = null OR $session.params.surname != null OR ($session.params.name! = " ") OR ($session.params.surname != " ")
      'true'
    else
      'false'
    endif