activities
latest
false
UiPath logo, featuring letters U and I in white
Workflow Activities
Last updated Nov 18, 2024

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.



Adding advanced logic to a form component

To add advanced logic to a form component:

  1. In Form Designer, click the Edit docs image 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

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.

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 are not available.
  • ECMAScript 6 is not supported. You can use ECMAScript 5 or use a source-to-source compiler.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.