DSL rule with received command on two items does not have triggeringItem

In my relatively fresh OH3.1 installation on RPi4, I have created a rule in the GUI. The rule has two triggers, each of them of type item receives a command and and action in form of a DSL script - basically, I am just trying to replicate this rule.

My problem is that in the script, triggeringItem is null, so accessing triggeringItem.name fails with error message that getName() cannot be used on null. I need this in order to find out which of the two items triggered the rule.
On the other hand receivedCommand works as expected.

What am I doing wrong?

Yes. triggeringItem is only present (in OH3) when you use “Member of Group” type triggers.

triggeringItemName is available for ordinary Item triggers.

Thanks a lot.
I was confused by this documentation - possibly not updated for OH3?

Unfortunately that repo is not and cannot be updated for OH 3. See GitHub - CrazyIvan359/openhab-helper-libraries: JSR223-Jython scripts and modules for use with openHAB for a fork that includes updates for OH 3.

But one has to wonder why you are looking at docs for the Jython and JavaScript Helper Libraries for hints for using Rules DSL. In Rules DSL there is no event Object really. The variables are injected into the Rule’s context directly.

Hi Rich, I understand why you wonder, but it seems quite logical at the time: I had tried to replicate one of the design patterns in the forums, got an error, searched for it, and somehow ended up on the documentation site I was referring to. It seemed to confirm that what I was doing (using triggeringItem.name in the rule) should work, so I posted a question to the forum.
In retrospect, I should have read the documentation instead of searching, I will try to remember it next time…