Rules module

Hello everyone,

I am back with more issues…

I’ve just read some posts about same topic but they were more related to sending notifications. So let me just explain my issue.

We have some rules in D7 to be migrated to D8. Problem is, after I installed the D8 Rules module I miss some functionalities. It seems the project is been discontinued or no one is taking care of it.

First, there is no import rule option so they need to be re-created.

In D7 rules module, we capture the event 'saving content of type ‘EN-CV Project’ in order check some values and change a field value.

image

In D8, we can’t select the content type ‘EN-CV Project’ so we need to enter the values without any reference. The way to enter the values is not well documented making difficult to enter any value.

Then, we specify the value of the fields we want to check to do some comparisons :

image

This menu is not the same in D8 so it is also impossible to find both the fields and values as in D7 module.

My question is, is it the module itself that needs to be upgraded or I’d need to use another module to do this in D8?

Do you know about any other module I could use for this purpose?

Thanks,
Juan

Hi Juan,

The Rules module is in alpha state and it’s missing many of its Drupal 7 features. From what I see in the module’s page, there is dev version that it was last updated on 22 May 2020.

You can download this version and install in your website. Mount your website’s filesystem, put the Rules dev version under the modules folder. Then go to https://yourwebsitename.web.cern.ch/update.php to check if any database updates are required and if so apply them. Clear the caches.

Just have in mind that you shouldn’t have any alpha or dev versions of modules on a production website. Usually these kind of versions are unstable. I will do that only if it is necessary and always keep an eye on these modules.

I don’t know of any other module similar to Rules.

Hi Sotirios,

Ok I see the one I installed from CERN admin page was alpha version (8.x-3.0-alpha5).

So I will install dev version and see what happens…

Thanks

I think I can’t install the dev version (rules-8.x-3.x-dev.tar.gz) cause it is previous to the one available at admin/extend (8.x-3.0-alpha5)

I get this error:

image

Hi Juan,

You need to follow the instructions of my previous post.

You need to take a backup of your website first. Go to https://yoursitename.web.cern.ch/_site and click on Backup link and create a backup.

Then download the dev version of the Rules module (zip file). Unzip the file.

Mount the file system of your website:

- For MAC: Click on Finder then click on Go at the top and Connect to Server. Use this link https://yoursitename.web.cern.ch/_webdav and your NICE credentials.
- For PC: Right click on My Computer and select Map Network Drive. Use the same link https://yoursitename.web.cern.ch/_webdav and your NICE credentials.

Go to modules folder and copy in there the Rules folder you just unzipped.

Then clear the caches of your website Configuration->Performance

Go to https://yoursitename.web.cern.ch/update.php and check if there are any database updates required by the new module and apply them.

Then clear the caches again and you should be ok.

Hi Sotirios,

Great! This looks better now:

Will see if I manage to make it work…I’ll let you know.

Just as a final step in your instructions, I also needed to go to admin/extend and install the new module (this time the updated dev version). Otherwise the rules component is not available at config page.

Thanks!
Juan

Great!

I thought you had it already enabled in alpha version. If you didn’t then yes you need to go and install it in Extend after you copy it in the modules folder.

I moved a bit forward but still can’t find the fields inside EN-CV Project. The Data selector doesn’t work as expected and there is no clue on how to find it.

image

So I try to enter something like ‘node.field-cv-cl-start-’(this is suposed to be the field I try to compare):

I did also try with:
node.field_cv_cl_start_
node.field-cv-cl-start-
{{node.field_cv_cl_start_}}

Also tried with Entity is of bundle but no luck…

Hi Juan,

The Rules module is quite different in Drupal 8. I managed to make it work in another website though.

First create a condition Entity is of bundle. In Data selector field put node, in Type value node, in Bundle value the machine name of your content type.

Then create a condition Data comparison. In Data to compare put value the field name (e.g. {{ node.body.value }} ) then choose the Operator and the Data value and save.

Hi Sotirios,

Nice,thanks for your help. I found the fields and managed to configure a simple rule.


It seems it is triggered when I save the page.

This is the log when the condition is not met:
image

However, when the comparison is TRUE, the page crashes with this error (I think…).

Missing filter plugin: filter_null .

I guess it is because the rules tries to update the field this time.

A further research brings me to different posts talking about text formats (filtered HTML) and some patches to apply.

We have dozens tens of fields to check and the error is not a clear error message after the crash.

Also enabled error display (just because this is dev env) and got this:

Maximum execution time of 60 seconds exceeded in /drupal/8.9.1/core/lib/Drupal/Core/Logger/LoggerChannel.php on line 168

Any idea on how could I trace this better?

Thanks,
Juan

The filter_null issue seemed to be a problem with Wiki text format. Once saved it disappeared.
image

However, the rule is still crashing :frowning:

Hi Juan,

The Rule I created on another website is with the alpha version of the module and works fine.

I suggest that you create a backup with the current state of your website, then uninstall the Rules module, mount your website’s filesystem and delete the module’s folder and then clear caches.

After enable the Rules module provided by the infra and check again. Maybe the errors are caused by the dev module. If you still get the error you can revert the website from the backup and we can take a closer look.

Hi Sotirios,

Ok, I did. Now I can’t select the entity type, it is just node

but ‘entity is of bundle’ allows me to select the entity:

Then I enter the comparison but this time I think the rule is not triggered

Hi Juan,

In Data to compare Switch to the direct input mode for Data selector and put the value as {{ node.field_cv_cl_start.value }}

Hi Sotirios,

Same result.

I may try tomorrow with this:

Hi Juan,

Could you tell me the URL of your website and what kind of test scenario are you running?

Hello Sotirios,

This is the link:

https://test-en-dep-cv-cl-v2.web.cern.ch/node/1298

You need to go to edit and then change the value ‘Data gathering’ to Yes and save the page

Then, the rule should update the Pipeline field to ‘Preparation’

You will need admin rights, I will give you the rights.

Hi Sotirios,

I already installed the module I mentioned (in .dev version) and the first test was successful. Still have to do some more tests but looks better.

Also gave you access so you can also check the original rule module

Regards,
Juan

Hi Juan,

I am glad to hear that. Let me know if you stuck somewhere and I will take a look.

Hi Sotirios,
I must say it doesn’t work neither. It works only for the first rule. I think there is a bug when a second one is created.
I notified the problem in the Drupal site. Let’s see if I receive any feedback.

Regards,
Juan