# Adding Advanced Logic Using Java Script

> You can build advanced conditions and logic into the design of Form Actions to guide Action Center users and reduce the likelihood of errors.

You can build advanced conditions and logic into the design of Form Actions to guide Action Center users and reduce the likelihood of errors.

![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-docs-image-183905-84d2917a.gif)

## Adding advanced logic to a form component

**To add advanced logic to a form component:**
1. In **Form Designer**, click the **Edit** ![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-image-edit_grid_icon_screenshot-739cd658.png) icon to open the component's properties.
2. Select the **Logic** tab.
3. Click **Add Logic**.
4. Fill in the **Logic Name** field.
5. In the **Trigger** block, choose **JavaScript** and add your code under **Text Area**. This should be a condition for when you want the advanced logic to apply.
6. Click **Add Action** to define what happens when the condition under **Trigger** is true.
7. Fill in the **Action Name** field and select an option from the **Type** list to choose if you want to change a property or value of this component.
   :::note
   Additional fields appear, depending on your selection, where you can specify how to change the selected item action that was customized.
   :::

Download the example [here](https://documentationexamplerepo.blob.core.windows.net/examples/Activities/JS_Expressions_in_Actions.zip)

## About JavaScript in the Action Center

In Action Center, JavaScript runs inside a sandboxed JavaScript interpreter, which lets you run safe JavaScript and blocks potentially harmful code.

Action Center uses **JS-Interpreter**, which is compatible with most modern browsers. For more information on limitations, security, or compatibility, see the [JS-Interpreter documentation](https://neil.fraser.name/software/JS-Interpreter/docs.html).

**Supported**
* JavaScript functions that return a value, for example:
   ```
   function add(p1, p2) {
      return p1 + p2;
      }
      return add((+data.number1), (+data.number2));
   ```
* Expressions that control the properties of components; for example, you can write an expression that hides a component if true:

JavaScript: `result=(data.number1 < 100 || data.number1 > 200)` Action: (**Type**: Property, **Component Property**: Hidden, **Set State**: True)

**Not supported**
* Browser, document, or window object properties are inaccessible. Also, setting properties on these objects doesn't have any effect.
* [Web APIs](https://developer.mozilla.org/en-US/docs/Web/API) are not available.
* ECMAScript 6 is not supported. You can use ECMAScript 5 or use a source-to-source compiler.
