Conditional rule on a particular value of slot

- rule: Modify rfq form
  condition:
  - slot_was_set:
    - phase: confirmation
  steps:
  - intent: modify
  - action: modify_form

I want to trigger the rule when a slot ‘phase’ == ‘confirmation’ only. Is that supported ?

@rick-li Yes, check this ref link and update your code Rules

Demonstration code:

rules:

- rule:  Modify rfq form
  condition:
  - slot_was_set:
    - phase: true
  steps:
  - intent: modify
  - action: modify_form

In your case, I am confused about which one is slot is that phase or confirmation?

Thanks @nik202 I understand it works for bool type of slot. but my slot type is text.

Seems like no matter what value ‘phase’ is it always trigger this rule, as long as phase is set.

btw “phase” is the slot, “confirmation” is the slot value

@rick-li may be form will solve your query?

i don’t see how form solves the issue… what i want is allow modify intent to trigger the rule only on some certain conditions, which i want to implement on a slot value.

i’m reading the docs - Events, perhaps i can add a pre_condition action before action: modify_form and return “rewind” event if conditional does not meet?

So seems this approach works

- rule: Modify rfq form
steps:
- intent: modify
- action: action_condition_check
- action: modify_form

In action

if last_intent == 'modify':
    if not rfq_phase == 'confirm':
        dispatcher.utter_message(text = 'Modify is not allowed here.')
        return [UserUtteranceReverted()]