Why does my Custom Action not execute in my form?

Hey there, I am using a form to ask the user about a country that he is interested in. My form looks like this:

  get_country_infection_form:
required_slots:
  country:
  - entity: country
    type: from_text
  satisfaction:
  - entity: satisfaction
    type: from_entity

So I have a slot country and satisfaction. My goal is to get the country, activate a custom action_infection_numbers_country that gives me the COVID numbers for the given country and asks the user if this is what he wanted with the slot satisfaction.

The problem is that the custom action does not execute mid form when I get the country but it directly jumps to the satisfaction slot, even though I set a rule specifying this:

    - rule: LOOP FORM
  condition:
  # Condition that form is active.
  - active_loop: get_country_infection_form
  steps:
  - slot_was_set:
    - country: germany
  - action: action_infection_numbers_country

I check if the slot was set to a country with slot_was_set and want to execute the action below, but it does not work.

Any help? Thanks!

Hello @KvenS

Yes, forms take precedence over rules here (so to speak). So either you split your form into two forms, with the rule in between (each form would ask for only one slot then), or you move your custom action code inside the form validation function: Forms

1 Like

Thanks for that information Johannes, not quite sure if this priority is written in the documentation but I did not know about this. I managed to kind of achieve my wanted output by splitting it into two forms, with the action executing at the end of form 1 and chaining form 2 to it at the end.

1 Like