Command methods for button, and/or token availability in context

Nice! I can’t find executeSingleCommand anywhere in the API docs, but I assume the IntelliSense in the button editor will help and/or that it takes the entire payload that would normally go in to body?

The other stuff isn’t a huge deal for me, so no worries about that. :slight_smile:

EDIT: Indeed it shows up in the IntelliSense, and it takes the body payload—except you omit the wrapping array and leave it with 1 command (as the method name suggests).

For other people’s reference, here’s an example:

const fibery = context.getService('fibery');
const e = await fibery.executeSingleCommand({
    "command": "fibery.entity/query",
    "args": {
        "query": {
            "q/from": "Contacts/Customer",
            "q/select": [
                {
                    "user/Orders": {
                        "q/select": [
                            "Customer orders/name",
                            { "workflow/state": ["enum/name"] }
                        ],
                        "q/limit": "q/no-limit"
                    }
                }
            ],
            "q/where": ["=", "fibery/id", "$id"],
            "q/limit": 3
        },
        "params": {
            "$id": "aaaaaa-bbbbb-bbbb-aaaaaaaa"
        }
    }
});

console.log(e);
3 Likes