{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"ワーカーで JavaScript を実行"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"ワーカーで-javascript-を実行","__idx":0},"children":["ワーカーで JavaScript を実行"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ノードタイプ ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["browser_javaScript"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"機能","__idx":1},"children":["機能"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ノードに渡された値を処理するために、ワーカー内で JavaScript を実行します。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"デスクトップクライアントでの設定","__idx":2},"children":["デスクトップクライアントでの設定"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/java-script.f78ec83c0a1adee00f604c3f927de88bdd1cc7cb153070292b5f8d391a9fac33.0538f3a9.webp","alt":"デスクトップクライアントでの「ワーカーで JavaScript を実行」の設定"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["MoreLogin デスクトップクライアント V2.73.101 の英語インターフェースで撮影しました。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"入力","__idx":3},"children":["入力"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["これらのフィールドは ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.browserUi.inputs"]}," に置きます。"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"フィールド"},"children":["フィールド"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"型または値"},"children":["型または値"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"スキーマで必須"},"children":["スキーマで必須"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"実行時の既定値"},"children":["実行時の既定値"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"説明と制約"},"children":["説明と制約"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["params"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]},">"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["いいえ"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[]"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["params。エディターの初期値：",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[]"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["いいえ"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["—"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["JS スクリプトを実行"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["outputFormat"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]},"（変数参照をサポート）"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["いいえ"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{\"type\":\"string\"}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["出力形式。エディターの初期値：",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{\"type\":\"string\"}"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"モードごとの要件と制限","__idx":4},"children":["モードごとの要件と制限"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["スクリプトは終了可能なワーカー（データ処理用のコンテキスト）内で実行され、Web ページやデスクトップクライアントのメインプロセスにはアクセスしません。Web ページを操作するには、injectJavaScript を使用します。スクリプトのテキストは補間されません。params 内の object/array 型の定数パラメーターは、有効な JSON のオブジェクト/配列である必要があります（書き込み時に検証されます）。戻り値は outputFormat に従って検証または変換されます。outputFormat を省略した場合は、{\"type\":\"string\"} が使用されます（エディターの新しいノードと同じ）。戻り値がない場合は null になり、string 形式では文字列以外の値が JSON テキストになり、number/integer 形式では数値の文字列が数値になります。値を変換できない場合、ノードは OUTPUT_TYPE_MISMATCH で失敗します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["検証コード：",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RPA_NODE_INPUT_INVALID"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"入力の参照","__idx":5},"children":["入力の参照"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"フィールド"},"children":["フィールド"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"許可される形式"},"children":["許可される形式"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["params"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["outputFormat"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"出力","__idx":6},"children":["出力"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"出力フィールド"},"children":["出力フィールド"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"型または値"},"children":["型または値"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["value"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[\"null\",\"boolean\",\"number\",\"string\"]"]}," / array<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["JSON"]},"> / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["公開されているフィールドは、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["${nodeId.data.field}"]}," として参照します。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"json-の例","__idx":7},"children":["JSON の例"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ワークフローの ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nodes"]}," 配列、または別のノードの ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["blocks"]}," に入れる完全なノードオブジェクトです。前にある「要素データを読み取る」ノードの出力 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["read_title.data.text"]}," を読み取ります。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"id\": \"format_price\",\n  \"type\": \"browser_javaScript\",\n  \"data\": {\n    \"title\": \"Format the price\",\n    \"browserAction\": \"javaScript\",\n    \"browserUi\": {\n      \"inputs\": {\n        \"params\": [\n          {\n            \"key\": \"price\",\n            \"value\": \"${read_title.data.text}\"\n          }\n        ],\n        \"content\": \"return 'Price: ' + params.price;\",\n        \"outputFormat\": {\n          \"type\": \"string\"\n        }\n      },\n      \"exception\": {\n        \"timeout\": 30000,\n        \"policy\": \"interrupt\"\n      }\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/ja/browser-rpa/nodes"},"children":["ノードカタログに戻る"]}]}]},"headings":[{"value":"ワーカーで JavaScript を実行","id":"ワーカーで-javascript-を実行","depth":1},{"value":"機能","id":"機能","depth":2},{"value":"デスクトップクライアントでの設定","id":"デスクトップクライアントでの設定","depth":2},{"value":"入力","id":"入力","depth":2},{"value":"モードごとの要件と制限","id":"モードごとの要件と制限","depth":2},{"value":"入力の参照","id":"入力の参照","depth":2},{"value":"出力","id":"出力","depth":2},{"value":"JSON の例","id":"json-の例","depth":2}],"frontmatter":{"seo":{"title":"ワーカーで JavaScript を実行"}},"lastModified":"2026-11-20T14:40:39.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/browser-rpa/nodes/data/java-script","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}