UiPath Documentation
studio-web
latest
false
Studio Web-Benutzerhandbuch
Wichtig :
Bitte beachten Sie, dass dieser Inhalt teilweise mithilfe von maschineller Übersetzung lokalisiert wurde. Es kann 1–2 Wochen dauern, bis die Lokalisierung neu veröffentlichter Inhalte verfügbar ist.

Functions

Add a Python or TypeScript/JavaScript function to a Studio Web solution, set it up from a sample or from your IDE, debug it, and call it from other projects in the solution.

A function is a project that holds code-first logic, written in Python or in TypeScript/JavaScript. You add a function to a solution, and the other projects in the solution call it as a job. For how to write functions with the SDKs and the UiPath CLI, refer to About Functions in the Functions guide.

What you can do with a function in Studio Web depends on its language:

AktionPythonTypeScript/JavaScript
View the codeJaJa
Edit the codeNo. Edit the code in your IDE, then push it to Studio Web.Ja
Debug, with breakpointsJaJa

Add a function to a solution​

You can add a function only to an existing solution. The Start building window doesn't list it.

  1. Öffnen Sie die Lösung in Studio Web.
  2. In the Explorer panel, select Add to solution.
  3. Under Building blocks, select Function.

Studio Web adds the project to the solution and opens the Setup your function page. To set up the function, start from a sample or bring the code from your IDE.

Set up a function from a sample​

  1. On the Setup your function page, under Quick start, select Python or TypeScript / JavaScript.

    If the page doesn't show a language choice, only Python functions are available in your organization.

  2. Select Start with a simple sample.

Studio Web adds the sample files to the project and opens the code file. The Python sample adds two numbers. The TypeScript sample returns a greeting.

Both samples run as jobs. To build an HTTP function, which a coded app calls as its backend, refer to HTTP triggers and routing in the Functions guide.

Set up a function from your IDE​

In a Cloud Workspace solution​

  1. If the Setup your function page shows a language choice under Quick start, select the language of your function.
  2. Under Sync from your IDE into Studio, copy the project key, and add it to the .env file of your function project.
  3. Push the project from your IDE with the command shown on the page: uipath push for Python, or uip function push for TypeScript/JavaScript.

For how to create a function project in your IDE, refer to Getting started for Python, or Getting started with JavaScript.

For the options of the push command for TypeScript/JavaScript, refer to uip function push in the UiPath CLI guide.

In a Local Workspace solution​

In a solution stored on your machine, the Setup your function page shows Add your project instead of the sync steps.

  1. Create the function project in your IDE. For a Python function, generate it with uipath init --type function.
  2. Add the project files to the solution folder, the local folder that Studio Web uses to access your project files.

For more information about local solutions, refer to Solutions in the Local Workspace.

Debug a function​

  1. Optional: in the Properties panel of the function, choose the function to debug in the Entrypoint list.
  2. In the toolbar, open the Debug menu and select Debug configuration.
  3. On the Entrypoint arguments tab, under Input Arguments, enter a value for each input of the function. The fields match the input that the function declares.
  4. Optional: under Environment Variables, define the environment variables that the function reads at runtime. Studio Web masks secrets in the editor.
  5. Wählen Sie Speichern.
  6. Optional: to pause the run on a line, select the area to the left of the line number to add a breakpoint.
  7. In the toolbar, select Debug.

The Logs panel shows the progress of the run and the output of the function. The bottom panel shows the execution trace, with the input and output of each traced step. When the run pauses at a breakpoint, use Continue, Next step, or Stop in the toolbar.

Call a function from another project​

To call a function from an RPA workflow in the same solution:

  1. Open the RPA workflow and add the Run Job activity.
  2. In Process name, select the function under Defined resources.
  3. Select Input arguments.
  4. In the Data Mapping window, map each input of the function to a variable.
  5. Wählen Sie Speichern.

For the other ways to call a function, such as from a Maestro process, an agent, or an app, refer to Invoking functions in the Functions guide.

Publish a function​

You can't publish a function project on its own. Studio Web publishes and deploys a function with its solution. For details, refer to Publishing and deploying solutions.

War diese Seite hilfreich?

Verbinden

Benötigen Sie Hilfe? Support(opens in new window)

Möchten Sie lernen? UiPath Academy(opens in new window)

Haben Sie Fragen? UiPath-Forum(opens in new window)

Auf dem neuesten Stand bleiben