Rule executing even though one of two constraints is not met

So I’m using broadcast message to send some JSON and then use that for some pop-ups and stuff.

sample data being sent as command:

{
    "command": "DisplayPopup",
    "eventName": "NewOrder",
    "message": "New Order at <br/><br/>21:53",
    "id": 7307,
    "source": ""
}

This rule fires even though it shouldn’t

Constraints:

{CALL:jsonParse.getValue('[:Command]', 'eventName')} [EQUALS] MissedOrder
{CALL:jsonParse.getValue('[:Command]', 'command')} [EQUALS] DisplayPopup

pop-up in the above rule shows that the first constraint is not met
2022-04-04_21;50_1649130646_Samba.Presentation

script used to parse json:

function getValue(json, property)
{
    var jsonObj = JSON.parse(json);
    
    return jsonObj[property];
}

from rule debugger:

the above doesn’t show the constraints that were matched like this:
image

even this fires:

What’s happening? What am I missing? What did I do wrong?

Weird but Ive seen similar behavior in the past, its usually when you add a query or script in the custom constraint field

I know it sounds silly but have you tried doing something like this?

'{CALL:jsonParse.getValue('[:Command]', 'eventName')}' [EQUALS] 'MissedOrder'
1 Like

That’s how I initially did it - the screenshot is after I removed the tics to see if it changed anything.

New order pop-up is like that but it, too, fires if I eventName doesn’t match

Does it fire this rule even with not matching ‘command’? I mean, if it were to constrain only command

1 Like

Just using command:

image

this fires:

even this fires:

Is there any chance that the resulting popup message is produced by another set of rule/command setup?

I think it is worth checking what else might produce that popup… maybe your code which you are looking at is actually working and the popup is resulting from something else.

1 Like

I don’t think you can nest tags in a constraint like that.

If you put a execute automation command action in the message received, could you use the constraints to display/not display the pop-up on the next step? Just a thought.

1 Like

Thanks for the replies and suggestions guys/gals.

I just decided to role my own event and mutation and be done with it.

Thanks for being a sounding board.

3 Likes