---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# アクション - スコープ対象、グローバル

# アクション - スコープ対象、グローバル {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：9分

アクション API は、UI アクションスクリプト内の URL のデータを処理するメソッドを提供します。
この API を使用して、ユーザーが操作できる UI アクションを構成します。次のスクリプトは、UI アクション \[sys_ui_action\] テーブルで使用します。詳細については、「 [UI アクション](https://www.servicenow.com/docs/access?context=t_EditingAUIAction&version=australia&pubname=australia-platform-administration&ft:locale=en-US)」を参照してください。

この API のメソッドは、サーバー側の JavaScript では変数名「action」で参照されます。詳細については、「 [UI アクションを使用したインタラクションの作成](https://developer.servicenow.com/blog.do?p=/post/training-ui-action-101/)」を参照してください。

## アクション:getGlideURI() {#ariaid-title2}

ユーザービューを決定する GlideURI オブジェクトを取得します。
{#Action_getGlideURI__table_dxr_lfj_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 1. パラメーター]

{#Action_getGlideURI__table_dxr_lfj_nkb} {#Action_getGlideURI__table_exr_lfj_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | ユーザービューの URI パラメーターを表す GlideURI オブジェクト。 * [GlideURI: スコープ対象](https://servicenow-prod.fluidtopics.net/5QjSryhDMqgXOPW2iHVHHA#c_GlideURIScopedAPI "GlideURI API は、スコープ対象のアプリケーションで URI パラメーターを処理するメソッドを提供します。") * [GlideURI - グローバル](https://servicenow-prod.fluidtopics.net/DZ_jAavZDsexIkDfqDI8ZQ#GlideURIGlobalAPI "GlideURI API は、グローバルアプリケーションで URI パラメーターを処理するメソッドを提供します。") {#Action_getGlideURI__ul_f4h_5lj_5mb} 注: その他の戻り値は、null を含むエラーと見なされます。 |
[表 : 2. 返される内容]

{#Action_getGlideURI__table_exr_lfj_nkb}  
次の例は、ユーザービューを取得し、サービスカタログのホームページへのリダイレクト URL を設定する方法を示しています。

    var uri = action.getGlideURI();
    var path = 'catalog_home.do';

    uri.set('sysparm_view', 'catalog_default');
    action.setRedirectURL(uri.toString(path));

## アクション:getReturnURL() {#ariaid-title3}

UI アクションの完了後に表示されるリターンページの URL を取得します。
{#Action_getReturnURL__table_db4_ffj_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 3. パラメーター]

{#Action_getReturnURL__table_db4_ffj_nkb} {#Action_getReturnURL__table_eb4_ffj_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | UI アクションが完了した後に表示されるリターンページの URL。 |
[表 : 4. 返される内容]

{#Action_getReturnURL__table_eb4_ffj_nkb}  

    action.getReturnURL();

## アクション:getURLParameter(文字列 parameterName) {#ariaid-title4}

URL パラメーターの値を取得します。
{#Action_getURLParameter_S__table_alv_y2j_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| parameterName | 文字列 | URL パラメーター値について照会を行う URL パラメーター名の名前。 |
[表 : 5. パラメーター]

{#Action_getURLParameter_S__table_alv_y2j_nkb} {#Action_getURLParameter_S__table_blv_y2j_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | URL パラメーター値。 |
[表 : 6. 返される内容]

{#Action_getURLParameter_S__table_blv_y2j_nkb}  

    action.getURLParameter('sysparm_query');

## アクション:openGlideRecord(Object gr) {#ariaid-title5}

ユーザービューで GlideRecord を含むページを開きます。
{#Action_openGlideRecord_O__table_sy5_bfj_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| gr | [GlideRecord](https://servicenow-prod.fluidtopics.net/sq3Fh7Z2Yb_KuRvql0AZmg#c_GlideRecordScopedAPI "スコープ対象の GlideRecord API は、データベース操作に使用されます。") | ユーザービューで開くページの GlideRecord。 |
[表 : 7. パラメーター]

{#Action_openGlideRecord_O__table_sy5_bfj_nkb} {#Action_openGlideRecord_O__table_ty5_bfj_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 8. 返される内容]

{#Action_openGlideRecord_O__table_ty5_bfj_nkb}  
次の例は、インタラクションレコードから作成された発信者名とインシデントの説明を含める方法を示しています。詳細については、「[Customizing Configurable Workspace with declarative actions](https://www.servicenow.com/docs/access?context=declarative-actions-landing&version=australia&pubname=australia-platform-user-interface&ft:locale=en-US)」を参照してください。

    if(current.update()){
      var inc = new GlideRecord("incident");
      inc.newRecord();
      inc.caller_id = current.opened_for;
      inc.short_description = current.short_description;
      action.openGlideRecord(inc);
    }

## アクション:setNoPop(ブール、noPop) {#ariaid-title6}

現在のビューのページのポップアップウィンドウを有効または無効にするかどうかを示します。
{#Action_setNoPop_B__table_mms_gfj_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| noPop | ブーリアン | ページのポップアップウィンドウを有効または無効にするかどうかを示すフラグ: * true:ポップアップウィンドウを無効にします。 * false:デフォルト。ポップアップウィンドウを有効にします。 {#Action_setNoPop_B__ul_qmz_fwj_nkb} |
[表 : 9. パラメーター]

{#Action_setNoPop_B__table_mms_gfj_nkb} {#Action_setNoPop_B__table_nms_gfj_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 10. 返される内容]

{#Action_setNoPop_B__table_nms_gfj_nkb}  
次の例は、UI アクションのポップアップウィンドウを無効にする方法を示しています。


    action.setNoPop(true);

## アクション:setRedirectURL (オブジェクト URL) {#ariaid-title7}

このトランザクションのリダイレクト URI を設定します。これにより、ユーザーに表示される次のページが決まります。
ユースケースの場合:

* [UI ルーティングアクションの作成](https://servicenow-prod.fluidtopics.net/CJnqUP_YXY0s1WPb76umKg#t_CreateAUIRoutingAction "このソリューションを使用すると、インシデントまたは要求アイテムのどちらであるかを知らなくても、サービスデスクでレコードを作成できます。その後、サービスデスクはレコードを適切なテーブルにルーティングできます。")
* [HR ケースからのナレッジ記事の作成](https://www.servicenow.com/docs/access?context=ui-action-hrcase-article&version=australia&pubname=australia-servicenow-platform&ft:locale=en-US)
* [Task relationships with UI actions](https://www.servicenow.com/docs/access?context=r_UIActions&version=australia&pubname=australia-platform-administration&ft:locale=en-US)
{#Action_setRedirectURL_O__ul_i1s_2qk_lmb}
{#Action_setRedirectURL_O__table_bdm_2fj_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| URL | オブジェクト | リダイレクトとして設定する URL。URL は文字列または [GlideRecord](https://servicenow-prod.fluidtopics.net/sq3Fh7Z2Yb_KuRvql0AZmg#c_GlideRecordScopedAPI "スコープ対象の GlideRecord API は、データベース操作に使用されます。") として指定できます。URL を GlideRecord として渡すと、この値によってそのレコードのフォームにフォーカスが移動します。 |
[表 : 11. パラメーター]

{#Action_setRedirectURL_O__table_bdm_2fj_nkb} {#Action_setRedirectURL_O__table_cdm_2fj_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 12. 返される内容]

{#Action_setRedirectURL_O__table_cdm_2fj_nkb}  
次の例は、 [current](https://servicenow-prod.fluidtopics.net/MR_iuJKsobbMQT3Svd80TA "スクリプティングを使用して、スコープ指定された環境およびスコープ指定されていない環境内のテーブルから任意の要求アイテム変数を参照できます。") 変数を使用してユーザーを UI アクションから URL にリダイレクトする方法を示しています。

    var fixchg = new GlideRecord("change_request");
    fixchg.short_description= current.short_description;
    fixchg.comments= current.comments.getHTMLValue();
    // fixchg.parent = current.sys_id;
    fixchg.insert();
    FixChange();
     
    gs.addInfoMessage("Change "+ fixchg.number+" created");
    action.setRedirectURL(current);
    action.setReturnURL(fixchg);
     
    function FixChange(){
    var m2m = new GlideRecord('task_rel_task');
    m2m.initialize();
    m2m.child= current.sys_id;
    m2m.parent= fixchg.sys_id;
    m2m.type.setDisplayValue("Fixes::Fixed by");
    m2m.insert();}

次の例は、UI アクションの完了後に新しいインシデントレコードを作成し、新しいインシデントにリダイレクトする方法を示しています。

    var reqItem = current.u_item;
    var requestedFor = current.u_requested_for;
    var location = current.location;

    if(current.u_incident_request == 'Incident'){
      //Create a new incident record and redirect to the new incident
      var rec = new GlideRecord('incident');
      rec.initialize();
      rec.caller_id = requestedFor;
      rec.location = location;
      rec.insert();
      action.setRedirectURL(rec);
    }

    if(current.u_incident_request == 'Request'){
      //Build the url and route the user to the request item
      var url = '';
      if(current.u_item.sys_class_name == 'sc_cat_item_guide'){
        url = 'com.glideapp.servicecatalog_cat_item_guide_view.do?sysparm_initial=true&sysparm_guide=' + 
          reqItem + '&sysparm_user=' + requestedFor + '&sysparm_location=' + location;
      }
      else{
        url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem + '&sysparm_user=' +  
          requestedFor + '&sysparm_location=' + location;
      }
      action.setRedirectURL(url);
    }

## アクション:setReturnURL(オブジェクト URL) {#ariaid-title8}

UI アクションの完了後にこのトランザクションの戻り URI を設定します。この方法を使用して、ユーザーが送信から戻ったときにどのページが表示されているかを決定できます。
{#Action_setReturnURL_O__table_bdm_2fj_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| URL | オブジェクト | UI アクションが完了した後の戻り場所として設定する URI。URL は文字列または [GlideRecord](https://servicenow-prod.fluidtopics.net/sq3Fh7Z2Yb_KuRvql0AZmg#c_GlideRecordScopedAPI "スコープ対象の GlideRecord API は、データベース操作に使用されます。") として指定できます。 |
[表 : 13. パラメーター]

{#Action_setReturnURL_O__table_bdm_2fj_nkb} {#Action_setReturnURL_O__table_cdm_2fj_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 14. 返される内容]

{#Action_setReturnURL_O__table_cdm_2fj_nkb}  
次の例では、UI アクションを選択して、問題レコードと変更テンプレートの情報を使用して変更レコードを作成できます。変更後、ユーザーは [現在の](https://servicenow-prod.fluidtopics.net/MR_iuJKsobbMQT3Svd80TA "スクリプティングを使用して、スコープ指定された環境およびスコープ指定されていない環境内のテーブルから任意の要求アイテム変数を参照できます。") ビューに戻ります。詳細については、「 [スクリプト化されたテンプレート」](https://www.servicenow.com/docs/access?context=r_ScriptedTemplates&version=australia&pubname=australia-platform-administration&ft:locale=en-US)を参照してください。その他のユースケースについては、「 [Task relationships with UI actions](https://www.servicenow.com/docs/access?context=r_UIActions&version=australia&pubname=australia-platform-administration&ft:locale=en-US)」を参照してください。

    var change = new GlideRecord("change_request");
    change.initialize();
    change.short_description = current.short_description;
    change.description = current.u_details;
    change.cmdb_ci = current.u_service;
    change.priority = current.priority;
    change.requested_by = current.caller_id;
    change.assignment_group.setDisplayValue('Change & Release');
    change.u_status = 'New';
    change.parent = current.number;
    change.applyTemplate("standard_rfc");
    current.rfc = change.insert();
    current.comments = 'Change ' + change.number + ' created.';

    var mySysID = current.update();

    gs.addInfoMessage("Change " + change.number + " created");
    action.setRedirectURL(change);
    action.setReturnURL(current);

## action - setURLParameter(String parameterName, String parameterValue) {#ariaid-title9}

URL パラメーターの名前と値を設定します。
{#Action_setURLParameter_S_S__table_elv_z2j_nkb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| parameterName | 文字列 | URL パラメーターの名前。 |
| パラメーター値 | 文字列 | パラメーターの値。 |
[表 : 15. パラメーター]

{#Action_setURLParameter_S_S__table_elv_z2j_nkb} {#Action_setURLParameter_S_S__table_flv_z2j_nkb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 16. 返される内容]

{#Action_setURLParameter_S_S__table_flv_z2j_nkb}  

    action.setURLParameter('sysparm_query', 'priority=2^active=true');


