Your workflow endpoint will be called multiple times during a workflow run. Therefore:
- Place your business logic code inside the
context.runfunction for each step - Code outside
context.runonly serves to connect steps
If you are curious about why an endpoint is called multiple times, see how Workflow works.