- Introdução
- Para administradores
- Projetos de fluxo de trabalho de RPA
- Como criar um fluxo de trabalho de RPA a partir de uma ideia
- Criação de um projeto
- Como iniciar um fluxo de trabalho de RPA
- Gerenciamento de arquivos e pastas do projeto
- Conectar fluxos de trabalho de RPA às suas contas
- Configuração de atividades
- Gerenciamento de atividades em um projeto
- Como transmitir valores entre atividades
- Como iterar por itens
- Como gerenciar os dados em um projeto
- Configuração de um projeto para usar seus dados
- Como usar recursos de arquivos e pastas
- Configuração local para fluxo de trabalho de RPA e projetos de aplicativos
- Projeto do aplicativo
- Apps no Studio Web
- Definir um contexto externo usando parâmetros de consulta
- Definir um contexto externo usando eventos externos
- Use matrizes para preencher os controles Lista suspensa, Lista suspensa multiseleção e Botão de rádio
- Usar controles tabulares com entidades do Data Service em projetos de aplicativos
- Incorporar agentes de conversa
- Atividades do aplicativo
- Processos com agentes
- Caso do Maestro
- Tela de fluxo no Maestro Orchestrate
- Agents
- Functions
- Functions
- Soluções
- Fluxos de trabalho da API
- Testes
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:
| Ação | Python | TypeScript/JavaScript |
|---|---|---|
| View the code | Sim | Sim |
| Edit the code | No. Edit the code in your IDE, then push it to Studio Web. | Sim |
| Debug, with breakpoints | Sim | Sim |
Add a function to a solution
You can add a function only to an existing solution. The Start building window doesn't list it.
- Abra a solução no Studio Web.
- In the Explorer panel, select Add to solution.
- 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
-
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.
-
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
- If the Setup your function page shows a language choice under Quick start, select the language of your function.
- Under Sync from your IDE into Studio, copy the project key, and add it to the
.envfile of your function project. - Push the project from your IDE with the command shown on the page:
uipath pushfor Python, oruip function pushfor 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.
- Create the function project in your IDE. For a Python function, generate it with
uipath init --type function. - 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
- Optional: in the Properties panel of the function, choose the function to debug in the Entrypoint list.
- In the toolbar, open the Debug menu and select Debug configuration.
- 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.
- Optional: under Environment Variables, define the environment variables that the function reads at runtime. Studio Web masks secrets in the editor.
- Selecione Salvar.
- Optional: to pause the run on a line, select the area to the left of the line number to add a breakpoint.
- 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:
- Open the RPA workflow and add the Run Job activity.
- In Process name, select the function under Defined resources.
- Select Input arguments.
- In the Data Mapping window, map each input of the function to a variable.
- Selecione Salvar.
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.