Memo
April 5, 2022, 4:04am
1
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
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:
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
Memo
April 5, 2022, 4:25am
3
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
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
Jesse
April 5, 2022, 11:38am
8
I don’t think you can nest tags in a constraint like that.
Bob_be
April 5, 2022, 3:48pm
9
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
Memo
April 5, 2022, 4:18pm
10
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