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

# Global Variable

In Reportana's advanced automations and campaigns, you have access to the global variable `payload`, which can be used to access data within arrays and objects. This variable allows you, for example, to retrieve specific information from an array of orders and manipulate that data as needed. Additionally, the `payload` variable can be used within the **Execute JavaScript** block, providing even more customization options for the scripts executed through this feature. See the example below:

```JavaScript theme={null}
var totalPrice = payload.order.total_price
```

In this example, we store the total order value in the variable `totalPrice` by accessing the `payload.order` object and its `total_price` attribute (the total order amount). This allows us to perform, for instance, a calculation to automatically apply a discount coupon to the total order value:

<img src="https://mintcdn.com/reportana/Jha6odPLZMMTun1e/payload-en.png?fit=max&auto=format&n=Jha6odPLZMMTun1e&q=85&s=2914546f25938648b830a79cce4c6307" alt="Capturing with payload" width="793" height="324" data-path="payload-en.png" />

<RequestExample>
  ```javascript Example Code theme={null}
  var totalPrice = payload.order.total_price;

  function applyDiscount(totalPrice) {
    var discount = totalPrice * 0.15;
    var discountedPrice = totalPrice - discount;
    return discountedPrice;
  }

  var appliedDiscount = applyDiscount(totalPrice);

  payload.appliedDiscount;
  ```
</RequestExample>
