Hi guys,
I'm trying to schedule task in Business rules.

This is my scenario:
In my user profile there is a date field(contract expiration) and i want to set user to NOT ACTIVE after this date.

This is what i did:

  • I added a rule: Entity Insert with entity USER
  • I added a condition: contract_expiration > [current-date:html_date]
    • In this condition I added an action: schedule a task
      • In FIELD i have select my data field: contract_expiration
      • In IDENTIFICATION: [user:uid] - [user:display-name]
      • Set Time OFFSET and Add Action "Disable User" where I set "user status field" to 0 for disable user

So, when admin insert a new user, a new schedule task is added in Schedule Tab. And its ok.

But, if I try to run the task give me this error: "Error: Call to a member function getSubject() on boolean in Drupal\business_rules\Controller\ScheduleController->execute() (line 136 of modules/contrib/business_rules/src/Controller/ScheduleController.php)."

Am I wrong in something?

Comments

Kris77 created an issue. See original summary.

kris77’s picture

I solved erro this way:

Change raw in 136 with this:

$entity = $task_event ? $task_event->getSubject() instanceof Entity ? $task_event->getSubject() : FALSE : FALSE;

nwom’s picture

Status: Active » Needs work

I haven't ran into this issue myself, but noticed that the problem can supposedly be solved with the code in the previous comment, so somone would just need to create a patch. Setting to "Needs Work" in that case.