Need help with custom constraint

Hello,
I would like to put here a constraint which looks if the entity starts with 2.
Is there any possibility to do this here?13

Hmmm, not seen a starts with.
Would it not be suitable as a whole rule constraint?
It would be achiveable, either using a pair of larger/smaller expressions as you can string multiple constraints together with AND (&&) and OR (||) as well as bracketing for more complex grouping.
Also there is most likely the ability to ‘cut’ out the first number and use that in the constraint wither in a script or using a helper code.

Hi, thanks thought only that there could be a easier solution because there are already built in constraints like this 882ada5073dca6568825664ae487a472212167da

But rule constraints are not suitable?
Like I said there maybe be a helper expression but have not seen it for splice.
But know 100% a small script would definatly work.
Your constrint would be along the linces of;

‘{CALL:Tools.first({ENTITY NAME:Tables})’ == ‘U’ OR ‘{CALL:Tools.First({ENTITY NAME:Tables})’ == ‘T’
Where the script called Tools with finction ‘first’ would return the first letter using a splice function.
Alternativly you could validate in the script that first letter is U or T and return say ‘Yes’ and make the action constraint singular ‘{CALL:Tools.first({ENTITY NAME:Tables})’ == ‘Yes’

There may well be a helper for splice which would allow the ‘cutting’ of first letter inline in constraint however I am not familier with it. @Jesse do you know if there is an inline helper for splice?

It would be simpler to just seperate that action to a new rule run it before that rule and use rule constraint

1 Like

That’s a good shout, hadn’t looked at the action name.
Separate that action into it’s own rule with rule constraints and make sure it’s sort order for rules is before this one so it fires before order states are updated.

Hello,
I found together with @Nizam a way how to do it. It was in fact really simple.
UNADJUSTEDNONRAW_mini_e58

That’s a different rule.
If you apply that to the ticket closing rule be sure to cover the alternate split in ticket flow as the other rule with kitchen prints would also include state updates etc.