# Button to change entity state

**URL:** <https://forum.sambapos.com/t/button-to-change-entity-state/1416>\
**Category:** V4 Question\
**Created:** [May 31, 2014, 10:36am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416 "2014-05-31T10:36:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![windinghouse](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@windinghouse](https://forum.sambapos.com/u/windinghouse)\
**Post date:** [May 31, 2014, 10:36am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/1 "2014-05-31T10:36:36Z")

</div>

HI - by now I should know by now how to do this - but something else that I am struggling with 😄

I want to create a button that changes the state of an entity ( table in this case) from available to Occupied

This is for when a customer is seated but has not yet placed an order. All I need is to change the colour of the entity so that we can see from the screen that there is someone at that table. I don’t need to change the ticket state or anything else, just the colour of the entity.

I did have this working but since adding the kitchen display this has stopped working. I’m sure it’s simple but need some help please 😄

Thanks

Rob

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [May 31, 2014, 2:05pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/2 "2014-05-31T14:05:24Z")

</div>

A bit of a challenge, but sorted.

Create a new Status called `Occupied`

 ![](https://forum.sambapos.com/uploads/default/original/3X/b/5/b5e08e6e7a823e3453fd3ed4865079e487e1bc53.png) 

Create an Automation Command for Table Occupied

 ![](https://forum.sambapos.com/uploads/default/original/3X/0/5/05a94fac92323b1afdb055122306cd38f65bfc4d.png)  
 ![](https://forum.sambapos.com/uploads/default/original/3X/c/4/c464c5f647936c1acbe5bdc87e139fffb40ba0bf.png) 

Plus the good old Update Program Setting if you don’t have it

 ![](https://forum.sambapos.com/uploads/default/original/3X/e/f/efd986e2d5da0af6d65960f2330818a938f2f3a7.png) 

Table Occupied rule

 ![](https://forum.sambapos.com/uploads/default/original/3X/3/a/3a122b15d094818032506361b511fad2bc3f0146.png)  
 ![](https://forum.sambapos.com/uploads/default/original/3X/a/0/a0e862a011d7d06bf278fdabbf026726eb7f4e85.png) 

Update `New Ticket Creating Rule` rule to reset Occupied

 ![](https://forum.sambapos.com/uploads/default/original/3X/a/4/a46498deb21baaa98b0d222d85439e1569eda2be.png) 

Update `Update New Order Entity Color` so it doesn’t change Table to New Orders

 ![](https://forum.sambapos.com/uploads/default/original/3X/6/6/667c640c090b0280c7d82c5aa50095cc9a49bfb5.png)

End result - Yellow Table indicates Occupied

 ![](https://forum.sambapos.com/uploads/default/original/3X/9/7/979eb420985411edaebb56de0f1e9d7216e66b23.png)

---

<div class="post-metadata">

**Author:** ![windinghouse](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@windinghouse](https://forum.sambapos.com/u/windinghouse)\
**Post date:** [May 31, 2014, 2:46pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/3 "2014-05-31T14:46:15Z")

</div>

HI @JohnS I have tried this - but I can’t appear to get it work. I’m not sure if the fact that I have a kitchen display setup from here [Setup Courses - different serving areas on same order.. with entity screens](http://forum.sambapos.com/t/setup-courses-different-serving-areas-on-same-order-with-entity-screens/1353/14?u=windinghouse)  
not sure if that makes the states etc different on my setup.

I have replicated everything as per your step by step but clicking on the ‘Occupied’ buton just closes the ticket with no action or change in entity colour.

Thanks

Rob

---

<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:** [May 31, 2014, 2:58pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/4 "2014-05-31T14:58:47Z")

</div>

John I think I’ve missed the case you are trying to handle but I think I just works by updating entity state. I’ve exported my setup.

[OccupiedButton.zip](https://forum.sambapos.com/uploads/default/original/3X/d/b/db17772d101939374322620f44e343f3aa739137.zip) (825 Bytes)

---

<div class="post-metadata">

**Author:** ![windinghouse](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@windinghouse](https://forum.sambapos.com/u/windinghouse)\
**Post date:** [May 31, 2014, 4:31pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/5 "2014-05-31T16:31:24Z")

</div>

@emre  
I tried importing after I had added Johns guide above. but clicking on close would not close the ticket, if I then went back to main menu and to POS then it showed the entity colour had changed.

I tried stripping out what I had added with Johns guide and then importing , but this time clicking ‘Occupied’ would just close the ticket without change.

Thanks as ever

---

<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:** [May 31, 2014, 5:05pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/6 "2014-05-31T17:05:05Z")

</div>

OK. I’ve managed to fix that by adding two more constraints. However before implementing this I’ll recommend to wait for @JohnS’s response for getting his idea about that fix.

I’ve added `Order Line Count` check for these two rules to skip actions if there are no order lines inside ticket.

 ![](https://forum.sambapos.com/uploads/default/original/3X/6/0/601f1ea0058ac18af4fdd9dedef34550680a2c37.jpeg)

 ![](https://forum.sambapos.com/uploads/default/original/3X/0/c/0cfed6e84b3e15d6feca4b7bab2220f4f8e5aca6.jpeg)

---

<div class="post-metadata">

**Author:** ![windinghouse](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@windinghouse](https://forum.sambapos.com/u/windinghouse)\
**Post date:** [May 31, 2014, 9:11pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/7 "2014-05-31T21:11:48Z")

</div>

all working @emre - thanks so much! I’m running out of ideas now 🙂 everything is all now as I need it

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [May 31, 2014, 11:27pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/8 "2014-05-31T23:27:24Z")

</div>

I didn’t realise that you were using Emre’s Kitchen Display which could explain you my solution didn’t work for you.

---

<div class="post-metadata">

**Author:** ![windinghouse](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@windinghouse](https://forum.sambapos.com/u/windinghouse)\
**Post date:** [June 1, 2014, 4:00am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/9 "2014-06-01T04:00:28Z")

</div>

all working with the combination of yours and the couple of extra entries from emre - thanks for your help with this. Hopefully not many more questions now. Final testing today to make sure everything is doing what it should 🙂 thanks for all your help.

---

<div class="post-metadata">

**Author:** ![ginoli](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/g/90ced4/32.png) [@ginoli](https://forum.sambapos.com/u/ginoli)\
**Post date:** [August 20, 2014, 2:17am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/10 "2014-08-20T02:17:44Z")

</div>

I followed everything you have said here and everything I work on samba 1.4.48.

But I need to find out how to get this:

when I click on “Table Occupied” I want to save the number of people in the ticket (obtained following this tutorial: [Tracking Number of Persons](http://forum.sambapos.com/t/tracking-number-of-persons/207) and so A SIMPLE TICKET TAG) and some food that I add, however, that should not be sent to the kitchen until I do I click on Close.

How do I?

---

<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 20, 2014, 1:58pm UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/11 "2014-08-20T13:58:42Z")

</div>

You can include `Update Ticket Tag` action in Table Occupied Rule to update Person Count. If you set tag parameter as [?Person Count] (? means ask here) operator can enter person count. You can see some samples here…

> [@\[New 4.1.7\] Asking Action Parameter Values](http://forum.sambapos.com/t/new-4-1-7-asking-action-parameter-values/149):
>
> By using [?ParameterName] notation you can ask action parameter values. This action displays a Message Box when we click on an automation command. Since we supplied Message Parameter Value as [?Message] SambaPOS would ask a value for Message parameter before executing action. That window should appear when we execute the action. We should type a value for Message parameter and rule will execute with typed value. Clicking “Cancel” will abort whole rule execution so it can…

---

<div class="post-metadata">

**Author:** ![DenizAltun](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/d/439d5e/32.png) [@DenizAltun](https://forum.sambapos.com/u/DenizAltun)\
**Post date:** [December 31, 2014, 5:00am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/12 "2014-12-31T05:00:39Z")

</div>

Hi all, i have followed this guide and successfully added a reservation button which works great thank you!

my only question is how do i cancel the reservation?

---

<div class="post-metadata">

**Author:** ![pizzaeilat4](https://forum.sambapos.com/user_avatar/forum.sambapos.com/pizzaeilat4/32/461_2.png) [@pizzaeilat4](https://forum.sambapos.com/u/pizzaeilat4)\
**Post date:** [December 31, 2014, 5:58am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/13 "2014-12-31T05:58:30Z")

</div>

What do you mean?  
You like to cancel the ticket? Or just cancel the reservation tag?

---

<div class="post-metadata">

**Author:** ![DenizAltun](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/d/439d5e/32.png) [@DenizAltun](https://forum.sambapos.com/u/DenizAltun)\
**Post date:** [December 31, 2014, 6:09am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/14 "2014-12-31T06:09:47Z")

</div>

@pizzaeilat4 customer calls me and asks me to reserve him a table, i reserve him a table and it goes yellow on the entity screen to show that it is reserved.

the customer calls me back and tells me he changes his mind, how can i remove the reservation from the table, and make the table available again ?

---

<div class="post-metadata">

**Author:** ![DenizAltun](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/d/439d5e/32.png) [@DenizAltun](https://forum.sambapos.com/u/DenizAltun)\
**Post date:** [December 31, 2014, 6:12am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/15 "2014-12-31T06:12:08Z")

</div>

@pizzaeilat4 Cancel the ticket

---

<div class="post-metadata">

**Author:** ![pizzaeilat4](https://forum.sambapos.com/user_avatar/forum.sambapos.com/pizzaeilat4/32/461_2.png) [@pizzaeilat4](https://forum.sambapos.com/u/pizzaeilat4)\
**Post date:** [December 31, 2014, 6:13am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/16 "2014-12-31T06:13:23Z")

</div>

In that case you just need to cancel the ticket

---

<div class="post-metadata">

**Author:** ![DenizAltun](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/d/439d5e/32.png) [@DenizAltun](https://forum.sambapos.com/u/DenizAltun)\
**Post date:** [December 31, 2014, 6:14am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/17 "2014-12-31T06:14:18Z")

</div>

how do i do that, it does not give me the option to cancel ticket

---

<div class="post-metadata">

**Author:** ![pizzaeilat4](https://forum.sambapos.com/user_avatar/forum.sambapos.com/pizzaeilat4/32/461_2.png) [@pizzaeilat4](https://forum.sambapos.com/u/pizzaeilat4)\
**Post date:** [December 31, 2014, 6:15am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/18 "2014-12-31T06:15:37Z")

</div>

can you show a screen shot of that ticket?

---

<div class="post-metadata">

**Author:** ![DenizAltun](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/d/439d5e/32.png) [@DenizAltun](https://forum.sambapos.com/u/DenizAltun)\
**Post date:** [December 31, 2014, 6:17am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/19 "2014-12-31T06:17:34Z")

</div>

![](https://forum.sambapos.com/uploads/default/original/3X/a/b/ab68570d14808859b4b222ac0cce523583faa58a.png) ![](https://forum.sambapos.com/uploads/default/original/3X/d/3/d32d7e5f73cd6257981e97b3e5948031f03d3a79.png)

---

<div class="post-metadata">

**Author:** ![pizzaeilat4](https://forum.sambapos.com/user_avatar/forum.sambapos.com/pizzaeilat4/32/461_2.png) [@pizzaeilat4](https://forum.sambapos.com/u/pizzaeilat4)\
**Post date:** [December 31, 2014, 6:25am UTC](https://forum.sambapos.com/t/button-to-change-entity-state/1416/20 "2014-12-31T06:25:02Z")

</div>

When you hit close bouton it’s not closing?  
Please share your reserve table rule screen

[Next page](https://forum.sambapos.com/t/button-to-change-entity-state/1416.md?page=2)
