# Logic

The **Logic** tool lets you contain all of the inner workings of your workflow--filtering, restructuring and looping data--in a single, reliable step. Our AI assistant Yedric can help you build and adjust the logic.

## Configure <a href="#overview" id="overview"></a>

### Building a Logic workflow

Start by opening Yedric and asking him to `Build a workflow`. For example:

{% code overflow="wrap" %}

```
Build a workflow that sends Shopify orders over $100 with an "uploadery_1" line item to Google Sheets
```

{% endcode %}

Yedric will look for similar templates. If you decline the template install, he will ask a few clarifying questions, outline your workflow, and get to work adding your trigger, Logic step and action(s). As part of the workflow building, Yedric will write the logic script and build a diagram outlining your workflow's logic:

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FPv5eC8MaPiWi6UUwzFcv%2Flogic%20Step.png?alt=media&#x26;token=49cd302b-6e86-4453-bd74-a77e7ad1fc75" alt=""><figcaption></figcaption></figure>

Once your workflow is built, Yedric will let you know what needs to be done to complete the workflow setup, then walk you through manually running it to confirm it is working as expected. Describe any changes you need to make to Yedric. If everything looks good, turn on your new workflow.

### Editing a Logic step

The easiest way to edit a logic step is by clicking the Edit with Yedric at the bottom of the Logic step. Yedric will read your workflow and walk you through making the updates.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FodNwhVmOQZ6GWmqyCauo%2Flogic-edit.png?alt=media&#x26;token=8c75762d-3b90-4712-a79b-bb50020345fd" alt=""><figcaption></figcaption></figure>

If you are technical and would like to get under the hood, you can edit the Logic code. Click on `...` > `Edit Code`, and you can edit the JavaScript code powering the Logic step with the [MESA SDK](https://docs.getmesa.com/tools/custom-code/libraries/sdk).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getmesa.com/tools/logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
