# Close ticket rule

**URL:** <https://forum.sambapos.com/t/close-ticket-rule/2102>\
**Category:** V4 Question\
**Created:** [August 11, 2014, 3:19pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102 "2014-08-11T15:19:57Z")\
**Posts on this page:** 16\
**Page:** 3

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 11, 2014, 8:12pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/41 "2014-08-11T20:12:37Z")

</div>

I’m thinking triggers operate outside of a ticket. Load ticket should work. But how would you know its loading the ticket your on.

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [August 11, 2014, 8:17pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/42 "2014-08-11T20:17:16Z")

</div>

So… it was not me dping things wrong… LOL!! This should be the first time jajjajajajajajajajsjs

Thanks

G

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 11, 2014, 9:47pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/43 "2014-08-11T21:47:56Z")

</div>

It will let you close ticket if it comes from an automation command. But it seems that if you set a trigger to execute an automated command it will not fire when trigger executes.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 11, 2014, 9:51pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/44 "2014-08-11T21:51:14Z")

</div>

I tried using the Trigger Executed rule to trigger an action that executes a command then set a rule that on the executed command change price list, close ticket. the trigger worked but the actions did not. I double checked and the logic was right it should have fired.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 11, 2014, 9:53pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/45 "2014-08-11T21:53:02Z")

</div>

So it seems triggers are only working with specific actions and not all of them?

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [August 11, 2014, 10:43pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/46 "2014-08-11T22:43:04Z")

</div>

OK first of all let me give you some background information. We store prices in cache. That means as you add items to tickets SambaPOS does not read prices from database. When change price list action executes it raises a flag to clear cache and read prices from database. However if there is an open ticket we intentionally do not clear cache as soon as trigger executes. Since we can not determine when a trigger executes it may cause unpreventable errors. For example think of price change executes in the middle of the millisecond we’re calculating discounts and taxes. We can never know the issue relates to a trigger so I completely queue such methods to work after ticket close and it generally completes until it displays the entity screen or what comes next. Caller-id users will experience same behavior. SambaPOS never displays phone number popup (even multiple people calls) in the middle of the ticket creation. It displays queued popups as you close ticket.

So that might seem an error to you but there are rules 🙂 We created them to protect stability.

In fact we don’t need triggers at all to implement happy hour. Like @Jesse pointed few posts before we can implement an “apply happy hour price” action with `Update Order` action and execute it after `Order added to Ticket` if `{DATE:HH} > 20 & {DATE:HH} < 23`. That will also work fine in the middle of ticket creation.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 11, 2014, 10:56pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/47 "2014-08-11T22:56:41Z")

</div>

I had a hunch it was like this but I thought I would try and help gerlandog work through it to see possibilities

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 12, 2014, 3:59am UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/48 "2014-08-12T03:59:30Z")

</div>

That method of Happy Hour looks like it would be a better solution vs using triggers.

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [August 12, 2014, 10:24am UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/49 "2014-08-12T10:24:53Z")

</div>

Dear @emre, I fully understud what youwrote that is why my original question was why the close ticket action does.not work in my rule. I wouls likw to close the ticket so the change price list action can complete.

Thanks

G

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 12, 2014, 2:27pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/50 "2014-08-12T14:27:58Z")

</div>

I could be wrong, but if I am understanding Emre right its not working because you were calling it from a trigger… triggers will not work until the ticket is closed…

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [August 13, 2014, 11:14am UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/51 "2014-08-13T11:14:59Z")

</div>

So, the only part of the rule that is not working is the `CLOSE TICKET` action… becuase the `MESSAGE`, `CHANGE PRICE LIST` are working…

Why `CLOSE TICKET` would not work?

Thanks!!!

G.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 13, 2014, 10:25pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/52 "2014-09-13T22:25:50Z")

</div>

Out of curiosity do you assign customers to the ticket before this rule would be applied?

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [September 13, 2014, 10:26pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/53 "2014-09-13T22:26:55Z")

</div>

no, Customers no, but there is allways a table assigned.

G.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 13, 2014, 10:27pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/54 "2014-09-13T22:27:47Z")

</div>

I still think its because its being fired from a trigger. Maybe close ticket action cannot be fired from a trigger to preserve stability.

---

<div class="post-metadata">

**Author:** ![gerlandog](https://forum.sambapos.com/user_avatar/forum.sambapos.com/gerlandog/32/39076_2.png) [@gerlandog](https://forum.sambapos.com/u/gerlandog)\
**Post date:** [September 13, 2014, 10:29pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/55 "2014-09-13T22:29:04Z")

</div>

I will do this excercise… I will ad a close ticket rule to an ORDER ADDED rule… to see what happens…

g.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 13, 2014, 10:29pm UTC](https://forum.sambapos.com/t/close-ticket-rule/2102/56 "2014-09-13T22:29:46Z")

</div>

Close ticket works just fine within rules I use it in my system quite a bit. We do not know all of the rule restrictions put in to protect stability maybe one day we will.

EDIT: I just added it to my Order Added rule and it closed ticket immediately after adding my first item.

I really think this was unique to your attempted use of it. I think it will not fire from a trigger.

[Previous page](https://forum.sambapos.com/t/close-ticket-rule/2102.md?page=2)
