# Action Buttons Q&A

**URL:** <https://community.fibery.io/t/action-buttons-q-a/1172>\
**Category:** API & Programming\
**Created:** [November 15, 2020, 5:25pm UTC](https://community.fibery.io/t/action-buttons-q-a/1172 "2020-11-15T17:25:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 15, 2020, 10:21pm UTC](https://community.fibery.io/t/action-buttons-q-a/1172/2 "2020-11-15T22:21:45Z")

</div>

I think it’s a nice idea - I too am an Action Button fan but with no JS experience or training, relying on trial&error, guesswork and determination. I have become better over time, but I also know that @Haslien and @Sergey_Truhtanov are pretty helpful if you get stuck.

To begin with, I’m pretty sure that I can answer Q1:  
The entity’s state field is pretty much the same as any other single-select field, which means that behind the scenes, it is a type of its own, and you have to treat it accordingly.  
For example, the following code will get you the state of an entity:

```
for (const entity of args.currentEntities) {
    const item = await fibery.getEntityById(entity.type, entity.id, ["State"]);
    const state = item["State"];
    return state["Name"];
}

```

Also, I will add that the (totally undocumented) `fibery.executeSingleCommand` is a brilliant way to achieve lots of stuff that would otherwise become a bit cumbersome using just the standard action button methods.  
Have a look here: [Command methods for button, and/or token availability in context](https://community.fibery.io/t/command-methods-for-button-and-or-token-availability-in-context/1035)  
This method might actually help with Q3. I don’t think there is any way to get all fields without knowing what fields you’re asking for. But you could use the `"command": "fibery.schema/query"` to get the full structure of all your types, and from there, you could iterate through reading all the fields of a given entity’s type.

Using `fibery.executeSingleCommand` does require getting to grips with objects, but it’s actually not as hard as you might think, and I got a useful tip for a good JS learning resource: [Extracting useful info from \<del\>JSON\</del\> JS object](https://community.fibery.io/t/extracting-useful-info-from-del-json-del-js-object/1131/7)  
Plus, the documentation for the general API commands is pretty easy to follow.

As for Q2, yes it is definitely possible:  
`await fibery.updateEntity(entity.type, entity.id, { "Name": "Hi 👍" });`  
😊

---

_[View the full topic](https://community.fibery.io/t/action-buttons-q-a/1172)._
