# How to set up and edit a business rule

## Set up a business rule

To start setting up a new business rule click the "+ Create business rule"-button in the top right corner of the Business rules page.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2F2MVJVtw8Sq6JghMDStBf%2Fimage.png?alt=media&#x26;token=33b69111-b9c8-4559-88f2-9518ce3fd530" alt=""><figcaption><p>Business rules page</p></figcaption></figure>

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FMRMstSY7ls9tsYCAQ8kA%2Fimage.png?alt=media&#x26;token=826bd2f7-152a-478e-9d98-2c6618eecdf9" alt=""><figcaption><p>Business rule setup page</p></figcaption></figure>

You must choose a name for your business rule, this name does not have to be unique because the business rule will be assigned a Uid. We suggest using explanatory and distinct names however, as this wil make it easier for everyone working in the PIM.

You can give the rule a description and choose whether the rule is active or not.\
When you are happy with the name and description click 'Next'.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FLQzPeJpdck9tX9UVlolR%2Fimage.png?alt=media&#x26;token=c85d342f-b0a7-4cd2-bd55-d837e02b4820" alt=""><figcaption><p>Select trigger</p></figcaption></figure>

Now you need to choose a trigger. To do so, click "Click to select a trigger". This will open a select trigger wizard. &#x20;

<div align="center"><figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FOoRW4xKUyWQXflvjoopp%2Fimage.png?alt=media&#x26;token=2c30d27d-6f8e-438b-b28e-1d39111f0ba7" alt=""><figcaption><p>Select trigger</p></figcaption></figure> <figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2F9syJ16kqZ9OgVa2uopLf%2Fsetup_trigger.png?alt=media&#x26;token=104fdee9-ff75-4a8c-81f3-a16b2141c0fe" alt=""><figcaption><p>Configure trigger (Variant value changed)</p></figcaption></figure></div>

Within the wizard you must first choose a [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) that determines when your rule will run. For this example 'Variant value changed' is chosen.\
\
The wizard will ask you to select any setting for the [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) if applicable. In this example the wizard asks what attributes to look for. When you have chosen the necessary settings click "Confirm".&#x20;

This will take you back to the business rule setup page. Under the trigger that was chosen, a box with the text "Execute these actions" will have appeared. Click "Add Action" inside the box to open up 'Select action'. <br>

<div><figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FhNWAGuP9M4RMeq7p8tmE%2Fimage.png?alt=media&#x26;token=68902547-fb61-451b-8e09-c696dde7cd00" alt=""><figcaption><p>Select action</p></figcaption></figure> <figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FmF0bWDJXkvFpWpBT6lC2%2Fconfigure_action.png?alt=media&#x26;token=fb3222d9-f21e-4eeb-b8c4-d262dee52596" alt=""><figcaption><p>Configure action (Create a task)</p></figcaption></figure></div>

Choose the [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) you wish for your business rule to execute. The available [actions](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) depend on the chosen [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details). For this example "Create a Task" is chosen.\
\
When you have chosen an [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details), you will be asked to configure that[ action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details). In this example we need to set up a task.\
\
When you have configured your [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) click "Confirm". This will take you back to the business rule setup page. Note that you can add more than one [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) to your business rule.&#x20;

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FobtGRPO4yepPkLCsM6iX%2Fimage.png?alt=media&#x26;token=4a1e5f02-c896-45fb-b760-e7273af6639b" alt=""><figcaption></figcaption></figure>

When you have finished setting up your business rule click "Create business rule". This will save the business rule and assign it a Uid.

To test that your business rule runs; hover your cursor over the trigger and a small "Start"-button should appear in the top right corner of the box.&#x20;

## Edit Business rule

To edit your business rule hover over the [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) or [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) you want to edit. A ![](https://content.gitbook.com/content/uUonpFWM7AJ0xVVXV1tr/blobs/bCMV7rAutTEI5ktPLTOg/Screenshot%202025-01-09%20144110.png) symbol will appear in the top right corner. Editing an [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) or [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) will allow you change the configuration but not the type.&#x20;

To delete an [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) or [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) simply click the "Trash can"-icon when hovering over them. If you delete the [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers) you will delete the entire rule setup for your business rule.

[Actions](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) can be dragged around to change the order in which they execute.&#x20;
