> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Business Rule Application Based on Variable Content Using Custom Variable Map

In this scenario, a Mock API will be created on Apinizer. In the request to be made, the value **stop=true** will be added to the **customVariableMap** variable using script.

In the next stage, a **Business Rule** policy will be added and the value in **customVariableMap** will be checked. If this value is **stop=true**, **the request will be prevented from going to the backend**

Let's add policies through Add policy.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom1.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=a698d92a9481e233457a8adea8aebdf5" alt="Adding to All section" width="1000" data-path="images/tutorials/custom1.png" />

We add **Script** and **Business Rule** as policies.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom2.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=7bafad6be61ffb8f2b02359609b24668" alt="Adding to All section" width="1000" data-path="images/tutorials/custom2.png" />

In the **Script** policy, by selecting the **Groovy** language, stop=true will be assigned to the customVariableMap value.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom3.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=fe6bd651bd8d43579136e7c5a1310282" alt="Adding to All section" width="1000" data-path="images/tutorials/custom3.png" />

Let's select the **stop** action we determined in the Business Rule policy.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom4.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=97c14f52d73dd227d1432776ba5cde32" alt="Adding to All section" width="1000" data-path="images/tutorials/custom4.png" />

Select **"'Custom Variable'"** from the **Conditions** field, write **stop** in the name field, and save.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom5.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=aa873b105155ddd32b0dda02f4bb8530" alt="Adding to All section" width="1000" data-path="images/tutorials/custom5.png" />

With the rule you added below, if the value in **customVariableMap** is **"'true'"**, the request will not be forwarded to the backend.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom6.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=f2a754bf31882be9709e86a4d4ed32a9" alt="Adding to All section" width="1000" data-path="images/tutorials/custom6.png" />

When the test is performed from the console below, a response message indicating that the request was stopped is returned.

<img src="https://mintcdn.com/apinizer/HiBfbNsbZ_uiLkpe/images/tutorials/custom7.png?fit=max&auto=format&n=HiBfbNsbZ_uiLkpe&q=85&s=6c02fc4b4da78a96be57d5579a6b698c" alt="Adding to All section" width="1000" data-path="images/tutorials/custom7.png" />
