# Trigger Machine Flows via BPA using commands

## IFS Workflows/BPA

Workflows in IFS cloud is their take on Low Code workflows powered by Camunda. It doesn’t come close to Novacura Flow but has the advantage that it’s integrated into IFS cloud. You can for example prompt for input directly inside of Aurena, you can also connect it to a particular projection being triggered. Much like how events used to work.&#x20;

#### **Read more:**

{% embed url="<https://docs.ifs.com/techdocs/23r2/040_tailoring/225_configuration/200_client_configurations/300_commands/>" %}

{% embed url="<https://docs.ifs.com/techdocs/23r2/040_tailoring/500_business_process_automation/020_what_are_workflows/>" %}

## How to trigger a Machine Flow via IFS workflows using REST

### Creating the IFS Workflow

1. Navigate to **Workflows** and press **New.**

<figure><img src="/files/wOrmOgTxuhQ8HQ7bg6WV" alt=""><figcaption><p>Create a new Workflow</p></figcaption></figure>

2. Give the workflow a meaningful name. Press **ok.**

<figure><img src="/files/6GNWfF0Rqa1Dm10gZH4e" alt=""><figcaption></figcaption></figure>

3. Press **Expand.**

<figure><img src="/files/azNNDb6rlKqtZo3rSJby" alt=""><figcaption></figcaption></figure>

4. Select the version you want to edit. Then press **Design.** This will open the Workflow Designer.

<figure><img src="/files/9oeY7R3tnHJA5oOHpAvV" alt=""><figcaption></figcaption></figure>

5. Pull the **Task** and **EndEvent** element to the design area.

<figure><img src="/files/WoG14y7fGDluklBw85zD" alt=""><figcaption></figcaption></figure>

6. Options appear when clicking an element. Connect the elements with **arrows**.&#x20;

<figure><img src="/files/XF7AFZIT1oudSCN3try2" alt=""><figcaption></figcaption></figure>

7. Change the task element to **IFS REST Call.**

<figure><img src="/files/HDUmseSPURqUKVJ2P6D0" alt=""><figcaption></figcaption></figure>

8. Time to configure the REST call. For simplicity a GET request with no input parameters is used in this example. It is possible to pass parameters as well.  The URL to the Flow can be found in Flow studio.

<figure><img src="/files/ENBugeUe7SINmqYhFZfu" alt=""><figcaption><p>Get the URL to the workflow</p></figcaption></figure>

Fill in the highlighted fields. Basic auth header is in the format username:password and is Base64 encoded.&#x20;

<figure><img src="/files/leGxVEJVFUjv1a6OMj69" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
In the example above the URL and Auth is **hardcoded**. This is **not recommended**. If you find a good solution to store and fetch them as global variables within IFS Cloud please contact **Project Office,** so we can update the guide. <project.office@novacura.se>&#x20;
{% endhint %}

9. Save the workflow and publish.&#x20;

<figure><img src="/files/81rr1j0GnK1D1rJaHLTT" alt=""><figcaption></figcaption></figure>

Click the **refresh symbol** to load the latest save. Select the version you want to deploy and click **Deploy.** Now the workflow is ready to be connected to a command.

<figure><img src="/files/f02922p3PiGEmJjzwgAS" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This guide is focused on how to setup a REST call to trigger a Machine Flow.  Please refer to IFS docs for more info on IFS Workflows.
{% endhint %}

{% embed url="<https://docs.ifs.com/techdocs/23r2/040_tailoring/500_business_process_automation/030_getting_started_with_workflows/>" %}

{% embed url="<https://docs.ifs.com/techdocs/23r2/040_tailoring/500_business_process_automation/040_workflow_tooling/#troubleshooting>" %}

### Adding custom command

{% hint style="warning" %}
Make sure that your Flow server is accessible from the IFS cloud instance.
{% endhint %}

1. Navigate to the page where you want your button and open the **page designer** to add your command.&#x20;

<figure><img src="/files/aKg3jZRRVGwYEWDqm1ZL" alt=""><figcaption><p>Open the page designer</p></figcaption></figure>

{% hint style="info" %}
The **page designer** won't be covered here but it's recommended you are familiar with it  and how to handle **contexts** before proceeding. Here's the section on Page Designer in  IFS Docs : <https://docs.ifs.com/techdocs/23r2/040_tailoring/225_configuration/200_client_configurations/100_page_designer_basics/>
{% endhint %}

2. Click the "+"-sign next to Commandgroups.

{% hint style="warning" %}
Make sure you put the command in the correct **context.**
{% endhint %}

<figure><img src="/files/qFv9UTyUbp4QzymQTvx6" alt=""><figcaption><p>Add command</p></figcaption></figure>

3. Choose **ExecuteWorkflow**

<figure><img src="/files/F2oVxdEjyRWSpkscbd9P" alt=""><figcaption></figcaption></figure>

4. Give the button a name and select the Workflow from the drop down list. And click **confirm**.&#x20;

Here you can also specify the parameters you want to pass to the workflow. Use the same, **${\<variable>},** annotation to point to that variable in the workflow.

<figure><img src="/files/rJdGqBS9AzKYQaHC1o8G" alt=""><figcaption></figcaption></figure>

5. Now your custom button should be visible if **"Preview of custom config..."** is enabled. Press the button and **VOILA!**&#x20;

<figure><img src="/files/59sF78jnFDy3aND335Fl" alt=""><figcaption></figcaption></figure>

6. The button command can now be **saved** and **deployed**.

<figure><img src="/files/aAipXPlowzlVSYLHvcub" alt=""><figcaption><p>Save</p></figcaption></figure>

<figure><img src="/files/UiiBkTSZZ5WeIUe3FVpI" alt=""><figcaption><p>Deploy</p></figcaption></figure>


---

# 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.novacura.com/flow-ifs-cloud-development-guidelines/flow-development-with-odata/trigger-flows-from-ifs-cloud/trigger-machine-flows-via-bpa-using-commands.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.
