# Actions
The schema allows you to define actions.
There are two main topics when talking about actions.

1. Actions
2. Process

Actions are execution of logic where a process is the sequential execution of several actions.

# Schema Examples

```json
{
    "actions": [
        {
            "id": 0,
            "action": "context.functionToPerform",
            "parameters": {
                "id": 10
            }
        }
    ]
}
```

Action 0 is a example where you want to perform an action on the view model of the screen that uses the schema.
In this case the function name is "functionToPerform" and when calling this function the parameters that will be passed on is the parameters object.
This parameters object contain as many properties as you like.

A implementation of functionToPerform could look like this:

```js
class ViewModel {
    functionToPerform(args) {
        console.log(args.id)
    }
}
```

The important part around actions is to remember that the execution context is the pragma-from rendering the schema.
When executing a path like "context.functionToPerform" this is always assuming pragma-form as the starting point.

If you want to perform a function on pragma-forms itself, you can do something like this:

```json
{
    "actions": [
        {
            "id": 1,
            "action": "setVariable",
            "parameters": {
                "name": "variable",
                "value": "model.dialyRate",
            }
        }
    ]
}

```

# Remote Actions

Some actions you want to perform are remote actions you want to execute on the server.
The pragma forms api does not know what server you are connected to or the requirements of how to call it.
To call these functions you need to mark them as being remote by adding the remote action name to the action definition.


```json
{
    "actions": [
        {
            "id": 2,
            "action": "RemoteFunctionName",
            "remote": "ResourceName",
            "parameters": {
                "id": 10
            }
        }
    ]
}
```

In Onkey development the remote key will normally be the resource name that the action resides on.