1

I am using the latest version of both drupal 8 and webform 8

Here is my use case:

I have on my drupal 8 website 3 different webforms (webform A, Webform B and Webform C)

Now, I want to fire a rule ONLY when "Webform A" is submitted.

I understand that we should use condition to limit the rule to one webform only.

For example in drupal 8 if i want to show a message on the website when a new content of type article is saved, i do the below:

1) EVENT: After saving new content (rules_entity_insert:node)

2) CONDITION: Node is of type; Node is of type: node; Content Types: article

3) ACTION: Show a message on the site.

And it is working pretty good when saving a content of type ARTICLE.

Now, i want ot do the same but using a webform instead of a node.

Here what i did so far:

1) EVENT: After saving a new webform submission (rules_entity_insert:webform_submissiom)

2) ACTION: Show a message on the site.

After saving a new webform submission, the message is indeed showing on the website which is perfect.

However, the problem is that the message is showing for any SUBMITTED WEBFORM.

In order to limit the rules to be fired only when the webform A is sumbitted, a condition should be added to the rule in question.

I have used the below conditions

"Entity is of type"

"Node is of type"

"Webform"

"Webforms"

trying to limit the rule for only one webform and all above conditions resulted an error on the site after trying to submit any webform:

(The website encountered an unexpected error. Please try again later)

And when i remove the condition added, the site work properly again.

Any idea what is going on ?

Or maybe i am using the wrong condition to specify only one webform ?

Main question:

What is the condition to be used in order to fire a rule ONLY when one specific webform has been submitted.

Thank you in advance,

1

I got this to work but i don't know if my answer will be the best approach for what i need:

Let's say, we want the rule to be fired ONLY for the webform ID: "contact"

1) EVENT: After saving a new webform submission (rules_entity_insert:webform_submission)

2) CONDITION: Data Comparision;

Data to compare: webform_submission.webform_id.target_id;

Operator: ==

Value: contact

3) ACTION: Show a message on the site.

Hope it will help somebody else as well, especially that there is no documentaion yet for rules 8.

Cheers,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy