No trigger item name when script called by rule triggered by a switch item

I want to have multiple item actions in a rule, and want to filter for the items triggering the script including their (new) value. I get the new (and depending on the action the old) state. But not the related item name…
Probably overlooking something: searches related to trigger item. But is a switch a trigger item, or what makes an item a trigger?

  • Platform information:
    • Hardware: Docker on Synology
    • OS: DSM/Linux
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: openHAB 5.1.4

configuration: {}
triggers:
  - id: "3"
    configuration:
      itemName: SunScreenUpSwitch
    type: core.ItemCommandTrigger
  - id: "4"
    configuration:
      itemName: SunScreenUpSwitch
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      considerConditions: true
      ruleUIDs:
        - SunScreenScript
    type: core.RunRuleAction

console.warn(([ctx.ruleUID,':',true,':',event.eventName,':',(event.receivedState ?? event.newState),':',event.oldState,':',event.itemName,':',event.receivedCommand,':',event.channelUID,':',event.receivedEvent,':',items.getItem('SunScreenCommand').state].join('')));
console.warn((['SunScreenUpSwitch',':',items.getItem('SunScreenUpSwitch').name].join('')));
console.warn((['SunScreenUpSwitch',':',items.getItem(event.itemName).name].join('')));

This script prints 3 log lines for each call:
First was triggered manually (playbutton) of the script and rule.
Next the related item switch was turned on and off.




15:57:19.554 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:::::::0
15:57:19.556 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
15:57:19.558 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry


15:57:27.823 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:::::::0
15:57:27.825 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
15:57:27.827 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry


15:58:23.515 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SunScreenUpSwitch' changed from OFF to ON (source: org.openhab.core.thing$zwavejs:node:aabcb81d8a:SunScreenUp:binary-switch-value)
15:58:23.518 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:ON::::::0
15:58:23.520 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
15:58:23.522 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry
15:58:23.526 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:ON:OFF:::::0
15:58:23.528 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
15:58:23.530 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry
15:58:24.436 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SunScreenUpSwitch' changed from ON to OFF (source: org.openhab.core.thing$zwavejs:node:aabcb81d8a:SunScreenUp:binary-switch-value)
15:58:24.438 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:OFF::::::0
15:58:24.439 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
15:58:24.441 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry
15:58:24.444 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:OFF:ON:::::0
15:58:24.445 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
15:58:24.447 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry
```

The ‘was updated’ in ‘When’ does not trigger the script.
The ‘changed’ showed the old state,
The ‘received a command’ only the new state.

The trigger item is the Item show state update, change, or command caused the rule to trigger. Any Item can become a trigger Item.

Please don’t post screen shots unless absolutely necessary. They can’t be searched, copied from, and in the case of these logs, they are completely unusable for any purpose what so ever.

Screen shots of the rule leave out a whole lot of necessary information. Always click on the code tab and paste the text you find there.

Use code fences.

```
code goes here
``` 

Without the text of the code :person_shrugging: . I can’t tell if the trigger only supports certain updates or not.

But over all, the name of the Item that caused the rule to trigger will be

image

This will have a value any time the rule is triggered by an Item. If run manually, called from another rule, time based trigger, etc.

What other properties are available depends on what sort of event caused the rule to trigger. For example, when is rule is triggered by a command, there won’t be a new state nor a previous state because a command doesn’t mean the Item actually changed state (or will ever change state). So you’d use

image

Note that every time something is sent to an Item it’s an update.

An update may result in a change which is a separate event. If you configure a rule to trigger on both updates and changes to an Item, the rule will trigger twice, once for the update and again for the change.

A command may or may not result in an update. If it does result in an update that changes the state of the Item, and you have triggers for updates, changes, and commands on the same Item, the rule will be triggered three times, once for the command, again for the update and finally for the change.

See Textual Rules | openHAB for a list of what properties will be available given the type of event that triggered the rule.

Added code to the original/first post, as generated by the UI.
The contextual info for received command and/or triggering item name remains empty when triggering the Rule SunScreenUpRuleboth by hand on its rules page, or by means of the connected Switch SunScreenUpSwitch.
Though the state of SunScreenUpSwitchis reported correctly in the script using the contextual info - new state of item.

Using codeblocks and Textual Rules | openHAB the trigger value attributes for variables event or ctx remain empty.
See logged warnings messages after the info message by the toggling the switch.

So for me it looks like I have Item…Triggers, but the itemName and others remains (unexpevtedly for me) empty.

console.warn(([ctx.ruleUID,':',true,':',event.eventName,':',(event.receivedState ?? event.newState),':',event.oldState,':',event.itemName,':',event.receivedCommand,':',event.channelUID,':',event.receivedEvent,':',items.getItem('SunScreenCommand').state].join('')));
console.warn((['codeblock1',':',event.triggeringItem].join('')));

console.warn((['codeblock2',':',event.triggeringChannel].join('')));

console.warn((['codeblock3',':',event.triggeringThing].join('')));

console.warn((['codeblock4',':',event.triggeringItemName].join('')));

console.warn((['codeblock1',':',ctx.triggeringItem].join('')));

console.warn((['codeblock2',':',ctx.triggeringChannel].join('')));

console.warn((['codeblock3',':',ctx.triggeringThing].join('')));

console.warn((['codeblock4',':',ctx.triggeringItemName].join('')));

console.warn((['SunScreenUpSwitch',':',items.getItem('SunScreenUpSwitch').name].join('')));
console.warn((['SunScreenUpSwitch',':',items.getItem(event.itemName).name].join('')));


18:21:12.205 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SunScreenUpSwitch' changed from OFF to ON (source: org.openhab.core.thing$zwavejs:node:aabcb81d8a:SunScreenUp:binary-switch-value)
18:21:12.208 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:ON:OFF:::::0
18:21:12.210 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock1:
18:21:12.211 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock2:
18:21:12.212 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock3:
18:21:12.213 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock4:
18:21:12.214 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock1:
18:21:12.216 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock2:
18:21:12.217 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock3:
18:21:12.219 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock4:
18:21:12.220 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
18:21:12.221 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry
18:21:13.517 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SunScreenUpSwitch' changed from ON to OFF (source: org.openhab.core.thing$zwavejs:node:aabcb81d8a:SunScreenUp:binary-switch-value)
18:21:13.519 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenScript:true:ExecutionEvent:OFF:ON:::::0
18:21:13.521 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock1:
18:21:13.522 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock2:
18:21:13.523 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock3:
18:21:13.525 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock4:
18:21:13.526 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock1:
18:21:13.527 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock2:
18:21:13.528 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock3:
18:21:13.529 [WARN ] [tion.jsscripting.rule.SunScreenScript] - codeblock4:
18:21:13.530 [WARN ] [tion.jsscripting.rule.SunScreenScript] - SunScreenUpSwitch:SunScreenUpSwitch
18:21:13.532 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'SunScreenScript' failed: org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry

You will never have a triggering item name defined in a rule triggered any other way than through an Item event. When you run it by hand, that’s not an Item event. There is no triggering Item. You will not have any of the “state” values either because there is no triggering Item, therefore there is no “state”.

The “received command” will only be populated when the rule is triggered by a command sent to a triggering Item.

The “new state of item” will only be populated when the rule is triggered by a change in the state of a triggering Item.

Event triggering item name received command new state previous state
Manual undefined undefined undefined undefined
item updated item’s name undefined Item’s state undefined
item changed item’s name undefined item’s state item’s old state
item command item’s name command undefined undefined

Your code is really way overcomplicated to easily show what you are trying to show and all those unnecessary joins will supress the undefined and who know what else they are doing.

Get rid of all the codeblocks.

Just make it simple. One log line per element with clear labels and nothing fancy.

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: TestSwitch
    type: core.ItemCommandTrigger
  - id: "2"
    configuration:
      itemName: TestSwitch
    type: core.ItemStateUpdateTrigger
  - id: "3"
    configuration:
      itemName: TestSwitch
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "4"
    configuration:
      type: application/javascript
      blockSource: <xml xmlns="https://developers.google.com/blockly/xml"><block
        type="oh_log" id="/nao-|/B;X/:O^0f,i~h" x="147" y="106"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="N-cmIID]pj?jK5|3Lj{+"><field name="TEXT">abc</field></shadow><block
        type="text_join" id="_bHt6O%Obyn]CT)L@ZDz"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id="S7:qj5iN^W,Q(m5-iaf2"><field name="TEXT">event available =
        </field></block></value><value name="ADD1"><block type="oh_context_info"
        id="#s$munDA^%~(Abd+|43*"><mutation asType="null"
        contextInfo="eventAvailable"></mutation><field
        name="contextInfo">eventAvailable</field></block></value></block></value><next><block
        type="oh_log" id="(}_Y19=_~RjW9{amUP6p"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="N-cmIID]pj?jK5|3Lj{+"><field name="TEXT">abc</field></shadow><block
        type="text_join" id="9Dn34fw_Xw,OSc$HL(K2"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id=")7:p{hNoXpG)NDN_^L10"><field name="TEXT">event type =
        </field></block></value><value name="ADD1"><block type="oh_context_info"
        id="`ehu!q6]frB8xP7iQq?G"><mutation asType="null"
        contextInfo="type"></mutation><field
        name="contextInfo">type</field></block></value></block></value><next><block
        type="oh_log" id="f7Xuw,L_;3~3(#w-fchG"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="N-cmIID]pj?jK5|3Lj{+"><field name="TEXT">abc</field></shadow><block
        type="text_join" id="p$!y4Y+.5a^6R[EdC}$6"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id="L8;|=*,X#3x2[$3y2Nqb"><field name="TEXT">triggering item name =
        </field></block></value><value name="ADD1"><block type="oh_context_info"
        id="}q~dyrSr*r%u%p)0tjZ["><mutation asType="null"
        contextInfo="itemName"></mutation><field
        name="contextInfo">itemName</field></block></value></block></value><next><block
        type="oh_log" id="qQ{cDM$Q4?@yg4xkK;2y"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="N-cmIID]pj?jK5|3Lj{+"><field name="TEXT">abc</field></shadow><block
        type="text_join" id="q+|j^WJf4^c#4L@4LD(B"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id="W*FRQb/5BVcWdi/qjLyw"><field name="TEXT">received command =
        </field></block></value><value name="ADD1"><block type="oh_context_info"
        id="(w4(Rb+0}L`c:Oo}lZu6"><mutation asType="asString"
        contextInfo="itemCommand"></mutation><field
        name="contextInfo">itemCommand</field><field
        name="asType">asString</field></block></value></block></value><next><block
        type="oh_log" id="7|P*}(nw-=N,yu5uj5o-"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="N-cmIID]pj?jK5|3Lj{+"><field name="TEXT">abc</field></shadow><block
        type="text_join" id="KT+MK-:P=seCFgM;KJ$|"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id="`BHW-aP-5g3}lP^0N2a2"><field name="TEXT">new state =
        </field></block></value><value name="ADD1"><block type="oh_context_info"
        id="{Hw*65IU,|PDW$(yS@?m"><mutation asType="asString"
        contextInfo="itemState"></mutation><field
        name="contextInfo">itemState</field><field
        name="asType">asString</field></block></value></block></value><next><block
        type="oh_log" id="7pz+Zyjc$*LKzrq^f:8+"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="N-cmIID]pj?jK5|3Lj{+"><field name="TEXT">abc</field></shadow><block
        type="text_join" id=":8@ei4-wd$lM1VP95|h:"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id="~)#H-9Ds9PY:vE]7Y[l@"><field name="TEXT">previous state =
        </field></block></value><value name="ADD1"><block type="oh_context_info"
        id="NJa$9@3`/*6WohpQB0e{"><mutation asType="asString"
        contextInfo="oldItemState"></mutation><field
        name="contextInfo">oldItemState</field><field
        name="asType">asString</field></block></value></block></value></block></next></block></next></block></next></block></next></block></next></block></xml>
      script: >
        console.info(('event available = ' + String(true)));

        console.info(('event type = ' + String(event.eventName)));

        console.info(('triggering item name = ' + String(event.itemName)));

        console.info(('received command = ' + String(event.receivedCommand)));

        console.info(('new state = ' + String((event.receivedState ??
        event.newState))));

        console.info(('previous state = ' + String(event.oldState)));
    type: script.ScriptAction

Manual trigger:

2026-04-15 11:10:37.773 [INFO ] [omation.jsscripting.rule.testBlockly] - event available = true
2026-04-15 11:10:37.780 [INFO ] [omation.jsscripting.rule.testBlockly] - event type = ExecutionEvent
2026-04-15 11:10:37.781 [INFO ] [omation.jsscripting.rule.testBlockly] - triggering item name = undefined
2026-04-15 11:10:37.782 [INFO ] [omation.jsscripting.rule.testBlockly] - received command = undefined
2026-04-15 11:10:37.787 [INFO ] [omation.jsscripting.rule.testBlockly] - new state = undefined
2026-04-15 11:10:37.788 [INFO ] [omation.jsscripting.rule.testBlockly] - previous state = undefined

Command followed by the resulting update followed by the resulting change events:

2026-04-15 11:13:20.740 [INFO ] [omation.jsscripting.rule.testBlockly] - event available = true
2026-04-15 11:13:20.744 [INFO ] [omation.jsscripting.rule.testBlockly] - event type = ItemCommandEvent
2026-04-15 11:13:20.749 [INFO ] [omation.jsscripting.rule.testBlockly] - triggering item name = TestSwitch
2026-04-15 11:13:20.750 [INFO ] [omation.jsscripting.rule.testBlockly] - received command = ON
2026-04-15 11:13:20.750 [INFO ] [omation.jsscripting.rule.testBlockly] - new state = undefined                                                                                                                         
2026-04-15 11:13:20.751 [INFO ] [omation.jsscripting.rule.testBlockly] - previous state = undefined

2026-04-15 11:13:20.757 [INFO ] [omation.jsscripting.rule.testBlockly] - event available = true
2026-04-15 11:13:20.759 [INFO ] [omation.jsscripting.rule.testBlockly] - event type = ItemStateUpdatedEvent                                                                                                                       
2026-04-15 11:13:20.760 [INFO ] [omation.jsscripting.rule.testBlockly] - triggering item name = TestSwitch
2026-04-15 11:13:20.760 [INFO ] [omation.jsscripting.rule.testBlockly] - received command = undefined
2026-04-15 11:13:20.762 [INFO ] [omation.jsscripting.rule.testBlockly] - new state = ON 
2026-04-15 11:13:20.770 [INFO ] [omation.jsscripting.rule.testBlockly] - previous state = undefined

2026-04-15 11:13:20.863 [INFO ] [omation.jsscripting.rule.testBlockly] - event available = true 
2026-04-15 11:13:20.864 [INFO ] [omation.jsscripting.rule.testBlockly] - event type = ItemStateChangedEvent
2026-04-15 11:13:20.869 [INFO ] [omation.jsscripting.rule.testBlockly] - triggering item name = TestSwitch
2026-04-15 11:13:20.873 [INFO ] [omation.jsscripting.rule.testBlockly] - received command = undefined
2026-04-15 11:13:20.874 [INFO ] [omation.jsscripting.rule.testBlockly] - new state = ON
2026-04-15 11:13:20.875 [INFO ] [omation.jsscripting.rule.testBlockly] - previous state = OFF 

To get the state of the Item from the Item’s name:

image

But note that’s going to throw an error when the rule wasn’t triggered by an Item event. It’s going to throw an error if you try to get the received command, but the rule was triggered by a changed event.

1 Like

Moin,

you use an external (existing) script. This does not get the events delivered. Copy your blocks into an inline script.

2 Likes

Indeed.

I replace my (external) blocks with the example of Rich Koshak. And noticed subsequently he added the blocks into the rule. So copied the blocks to the inline section as well. Adapted the first line of text to make clear which scripts logs. After pressing the hardware switch relatedItemStateChangedEvent had both scripts triggered by the rule.

As can be seen the inline script has an triggering item name, while the external one has an empty value.

Why the difference? For both scripts the event.newState and event.oldStateare present…

@rlkoshak and @Tschetan :

Is this a feature, bug, or feature request?

And/or did my software mind got stuck in its :blush: .

Now knowing the difference revisited/googled some pages:

In Textual Rules | openHAB there is also no mentioning of ‘inline’.

triggeringItem and triggeringItemName don't get propagated to script run by GUI defined rule does mention inline DSL and external Blockly, but the missing triggering item name is not clearly linked to being inline or not.

triggeringItem and triggeringItemName don't get propagated to script run by GUI defined rule - #13 by rlkoshak also does not link to being inline or not.

JavaScript Scripting - Automation | openHAB gives an example added as inline script, but does not mention the difference to calling an external script.

@rlkoshak Thanks for the support and supplying the table, its contents was already clear to me except is did not match fully what I noticed during debugging, and I like longer log lines :wink: .

21:06:26.578 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SunScreenUpSwitch' changed from OFF to ON (source: org.openhab.core.thing$zwavejs:node:aabcb81d8a:SunScreenUp:binary-switch-value)
21:06:26.580 [WARN ] [tion.jsscripting.rule.SunScreenScript] - external script rule UID =SunScreenScript
21:06:26.581 [WARN ] [tion.jsscripting.rule.SunScreenScript] - event available =true
21:06:26.582 [WARN ] [tion.jsscripting.rule.SunScreenScript] - event type =ExecutionEvent
21:06:26.583 [WARN ] [tion.jsscripting.rule.SunScreenScript] - triggering item name =undefined
21:06:26.584 [WARN ] [tion.jsscripting.rule.SunScreenScript] - received command =undefined
21:06:26.585 [WARN ] [tion.jsscripting.rule.SunScreenScript] - new state =ON
21:06:26.587 [WARN ] [tion.jsscripting.rule.SunScreenScript] - previous state =OFF
21:06:26.589 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - inline script rule UID =SunScreenUpRule
21:06:26.591 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - event available =true
21:06:26.592 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - event type =ItemStateChangedEvent
21:06:26.593 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - triggering item name =SunScreenUpSwitch
21:06:26.594 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - received command =undefined
21:06:26.596 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - new state =ON
21:06:26.597 [WARN ] [tion.jsscripting.rule.SunScreenUpRule] - previous state =OFF

As @Tschetan mentioned, the event doesn’t get passed to another script. Definitely review the Rules page under concepts and make sure you understand what is meant by “script” . Unfortunately, it’s a hopelessly overloaded term. But in this context, we have a “Script Action” which is a part of a rule and consists of code executed when a rule is invoked and the conditions pass. A “Script” is a wholly separate rule consisting of a single “Script Action”.

A “Script Action” is not the same thing as a “Script”.

When you call another rule from a rule (remember in this context your “Script” is a wholly separate rule), the called rule is being triggered by an ExecutionEvent, same as if you run it manually. Per the table above, triggeringitem name and none of the other properties are going to be part of that event.

You can think of it like a function call. Nothing gets passed to the called script unless you explicitly pass it as an argument. And if you do pass event as an argument, access to the data in event is going to be different (i.e. you must use the “get context attribute” block), not the block being used above.

Inline verses not inline didn’t come up in any of the above posts because in none of those cases was a rule calling another rulepart of the original questions. It’s not in those parts of the docs because there too it’s not part of what’s being discussed on those pages. In Textual Rules you can’t even create a rule that calls another rule (new feature coming soon though, PR is in work). And this issue isn’t really specific to JavaScript Scripting so it’s not really appropriate to cover it there. You can have a JS rule that calls a jRuby rule without any problems.

Having rules that invoke other rules is somewhat of an advanced feature, and maybe it should be hidden behind a “show advanced” checkbox or something. It’s definitely not intended to be the normal way to write rules. It has limitations (e.g. cannot return values, not thread safe, in JS MultiThreaded Exceptions will occur if two rules try to call the same one at the same time).

The event exists in a rule that was triggered. When you run another rule, that rule isn’t triggered. It’s run. That’s why the event type you see is an ExecuionEvent in the called rule.

Feature and working as designed.

The concept of “inline” doesn’t exist in text file based rules. A rule is a rule and your only option is to create a single “inline” script action in the language of the rule (I’m ignoring the new YAML file formats for rules for the time being as those are still in work). Creating a rule that only calls another rule as it’s action isn’t a possibility in file based rules.

But in the UI, a rule can have more than one Action and not all the Actions are scripts.

When asking for help on a forum, you would do well to make it as easy as possible for the people helping you as possible. I about gave up even trying to reply while trying to map your long cryptic log statement to the code. If you make us do more work than necessary, what support you do get will be of lower quality in proportion to the amount of work you make us do just to understand the problem. Make us do too much work and you will get no responses at all.

1 Like

:folded_hands:

..