UiPath Documentation
functions
latest
false
Functions ユーザー ガイド
  • 概要
    • Functions について
  • JavaScript functions
    • スタート アップ ガイド
    • Building JavaScript functions
    • HTTP triggers and routing
    • Function context
    • プラットフォーム サービスへのアクセス
    • テストおよびデバッグする
  • Python の関数
  • デプロイして実行する
重要 :
このコンテンツは機械翻訳によって処理されています。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

プラットフォーム サービスへのアクセス

Orchestrator assets, buckets, queues, and processes available to a JavaScript function through the UiPath TypeScript SDK, with the choice between delegated and function identity.

JavaScript functions reach platform resources through the UiPath TypeScript SDK. Nothing is hardcoded in the package: the coordinates come from ctx.platform and the token from one of the two identities the runtime supplies.

import { UiPath } from "@uipath/uipath-typescript/core";
import { Assets } from "@uipath/uipath-typescript/assets";

const { baseUrl, orgId, tenantId } = ctx.platform;
const sdk = new UiPath({
  baseUrl,
  orgName: orgId,
  tenantName: tenantId,
  secret: ctx.user.accessToken,   // or ctx.robot.accessToken
});
import { UiPath } from "@uipath/uipath-typescript/core";
import { Assets } from "@uipath/uipath-typescript/assets";

const { baseUrl, orgId, tenantId } = ctx.platform;
const sdk = new UiPath({
  baseUrl,
  orgName: orgId,
  tenantName: tenantId,
  secret: ctx.user.accessToken,   // or ctx.robot.accessToken
});

@uipath/uipath-typescript belongs in dependencies, not devDependencies: the deployed function installs production dependencies only.

ID の選択

パターントークンWho needs folder access
委任されたアクセス許可ctx.user.accessTokenThe calling user needs Assets.View on the folder
Function identityctx.robot.accessTokenOnly the function's service account; the caller needs nothing

Delegated is the default choice: the caller's own permissions apply, so the function cannot be used to see more than the caller is entitled to. The function's own identity is for resources that must stay out of the caller's reach — a credential in a restricted folder that only the function may read.

In that case, what the handler fetches must be constrained. A privileged backend that reads a caller-supplied resource name will hand over anything its identity can see:

const READABLE = new Set(["PartnerApiCredential"]);

if (!READABLE.has(input.assetName)) {
  throw new FunctionError(`"${input.assetName}" is not readable by this function.`, 403);
}
const READABLE = new Set(["PartnerApiCredential"]);

if (!READABLE.has(input.assetName)) {
  throw new FunctionError(`"${input.assetName}" is not readable by this function.`, 403);
}

アセット

const response = await new Assets(sdk).getAll({
  filter: `Name eq 'ApiBaseUrl'`,
  folderId: 42,
});
const value = response.items[0]?.value;
const response = await new Assets(sdk).getAll({
  filter: `Name eq 'ApiBaseUrl'`,
  folderId: 42,
});
const value = response.items[0]?.value;

folderId is required: without it the call returns metadata with empty values.

folderId is the folder's numeric id, not its key. A folder key is a GUID, and passing one where the numeric id belongs is rejected as a permissions error rather than a bad identifier, which sends you looking in the wrong place. ctx.platform.folderKey gives you the key of the current invocation; resolve the numeric id from it when a call needs one.

注:

A Credential asset's username and password are not returned by these endpoints, for any token. Reading one requires the function's own identity and the robot-execution route, which needs ctx.robot.key — so it works only in a deployed run. See Calling Orchestrator.

For a Secret asset, the value arrives in the SecretValue field. StringValue, the field that carries a Text asset's value, is empty for a Secret — reading it instead looks like a broken feature rather than the wrong field.

An asset also has an AllowDirectApiAccess setting that makes its value readable with the caller's own token. Turning it on is a widening, not an enablement step: the setting is identity-blind, so the value becomes readable by every identity holding Assets.View on the folder, including a browser holding the signed-in user's token. The function's own identity is the safer choice over enabling this setting.

その他

The same client exposes buckets, queues, jobs, processes, entities, and Integration Service connections. See the SDK reference for the full surface.

資格情報とセキュリティ

  • Secrets live in Orchestrator assets and are read at runtime — never hardcode them or commit them to the project.
  • Folder-level role-based access control (RBAC) governs what each identity can read. With the delegated pattern that is the caller's access; with the function's own identity it is the service account's.
  • Return a derived result rather than a secret wherever you can, and log the action, never the value.

次のステップ

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得