How to use Constrain for paid ticket permission?

@JTRTech is correct. The Entity Screen does not know the State of the selected Ticket on that screen because it is not loaded.

So you need a 2-part automation flow…

If that first screen is a Ticket Lister Widget, then the Ticket Id will be sent as the [:CommandValue] by default when you click on one of the buttons at the bottom.

Then in the Rule for the Automation Command Retirado, you should Load or Display the Ticket using the Ticket Id ([:CommandValue]), then fire another Automation Command (Call it “Check Status State” or something) using the Status State {TICKET STATE:Status} as the Command Value.

Alternatively, you could use a Report Expression to find the Status State based on the Ticket Id, and store that in a Local Program Setting, then use the Program Setting as the Command Value for the next AMC.

Either way, the second part is a Rule to handle the other AMC (Automation Command) named “Check Status State” …

In the Rule for that other AMC (“Check Status State”), check the Status State (which will now be in [:CommandValue]) using Action Constraints and depending on the State, you perform applicable Actions.

hi @QMcKay thanks for the answer,
i dont understand the workflow you explained…
I need my “Retirado Rule” with Load ticket action with “Command Value”
Then i need a Second Rule with other Load Ticket Action and an Automatioin Command?
And third rule ?

Or 2 AC in one Rule?

2 Rules:

  • Rule 1 ::: used to determined the Status State. This can be done by Loading the Ticket, or by using a Report expression. In this Rule, you will have 2 Actions:

  • an Action that Loads the Ticket, or uses a Report Expression to store the Status State in a Program Setting.

  • an Action that fires an AMC (Execute Automation Command Action), named “Check Status State” for example, and use the Status State (from the Loaded Ticket or the Program Setting) as the Command Value parameter.

  • Rule 2 ::: this is a Rule for the AMC that is fired from the first Rule (ie.“Check Status State”). Here we look at the [:CommandValue], which comes from the first Rule, and it will contain the Status State. We fire whatever Actions are necessary based on the [:CommandValue]. For example, from your first Screenshot, you have several Actions that are Constrained on the Status State. In this case, the Status Sate will be found in [:CommandValue] which we passed from the first Rule as a parameter.

##Rule 1:

Uses Load Ticket Action. IMO, this is not the best way. See Rule 1 (alternate) that follows.

##Rule 1 (alternate):

Uses Update Program Setting Action and Report Expression. IMO, this is a better method.

This is the Report expression:

{REPORT TICKET DETAILS:TS.Status:Ticket.Id=[:CommandValue]}

##Rule 2:

The [:CommandValue] in this Rule will contain either the value from {TICKET STATE:Status} [Rule 1], or the value from {SETTING:TicketStatusState} [Rule 1 (alternate)].

This is the Rule where you perform whatever actions you deem necessary, by constraining the Actions using [:CommandValue].

Wow thank you for the detailed answer @QMcKay

Yeah! It works thank you!

I have another question about an “ask question” action… and if i understand it right then in a “ask Question” Action if i put an “Cancel” Button then the AMC will not fire is that right?

It depends on your constraint for that AMC. If no Command Value in the constraint then it will execute.
The button you click will pass that value as Command Value.

ahahahahaha i answered my own question!!!
I used not “Cancel” i used “No” with “Cancel” it works but with “No” not. :smiley: lol

Oh i was a little too fast, no that has nothing to do with the other question…

i mean this…

If i put “No” or “Cancel” neverthless the command is fired…

Show the rule for the ask question command name.

Just put No=No of you dont have a comand value for No all that will happen when you press no is the ask question box will disappear

hi @JTRTech
here is the rule

No the rule with constraint of automation command name = ‘Rechung drucken’

ah thats the simple print bill rule

so i think it not makes diference if its this rule or another i used this rule only for testing…

the ask question triggers this rule via the automation command name.
If you want it to use the buttons you need to add comand value constraint to this rule.
either value = yes or does not = no.
Since it is only a yes no you can use either, if it was multi choice ask question you would want to to does = and not have a rule where command value = no

The Ask Question Action fires an Automation Command (ie. Print Bill) and passes the value of the clicked Button as the [:CommandValue] (ie. Yes or Cancel).

The Command Values have no special meaning - they are arbitrary. That is, the word “Yes” and “Cancel” have no special function. They are simply words/values. They could be blah123 and fluffy57, and those words become the [:CommandValue] that is passed to the AMC when “Si” or “No” buttons are clicked, respectively.

Si,No         ... if no CommandValue is specified, then the CommandValue becomes the button caption word
Si=Si,No=No   ... effectively the same as above

The Rule for the AMC Name which is triggered from the Ask Question Action should have a Command Value Constraint.

The [:CommandValue] that is passed from the Ask Question Action will be Yes or Cancel (or blah123 or fluffy57), depending on which button was clicked.

We can use that [:CommandValue] here to constrain this Rule, so that this Rule will only fire when the [:CommandValue] is Yes (or blah123)… or whatever.

1 Like

Yeah that works thank you now i understand… :+1:

thanks for the help you all!

If you want a video tutorial i did one for show change message with option print copy of receipt;