0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[ServiceNow]UI Action(sys_ui_action)を使用する

Last updated at Posted at 2025-01-20

※この記事はServiceNow初心者が学習用のために記載した記事です。内容について誤っている場合がございます。不足点などございましたらコメントいただけますと幸いです。

UI Actions

  • UI Action とは、ServiceNowのインターフェース上でユーザーが実行できるボタンやリンク、コンテキストメニューのアクションを定義する仕組み
  • UIアクションはクライアント側で実行される
    • ボタンを作成して、押下時のアクションを設定

使い方

「解決」ボタンを追加する

  • やりたいこと
    • Incidentフォーム画面で、Resolveボタンを作成し、そのボタンを押下するとStateがReslvedに更新される
  • Before
    2.png

1.UIアクションの作成

  • ナビゲーターで「UI Actions」を検索し、新規作成
  • 以下の情報を入力:
    • Name: 解決 (Resolve)
    • Table: Incident
    • Action name: resolve_incident
    • Form button: チェックを入れる(ボタンとして表示)
    • Condition: current.state != 'Resolved'
      (「解決済み」ではない場合のみボタンを表示する)※下の図に記載
      3.png

2.サーバーサイドスクリプトを記述
以下のスクリプトを記述します:

current.state = 'Resolved'; // 状態を「解決済み」に変更
current.update();           // レコードを保存

3.保存

  • Submitボタンを押下
    4.png

4.フォームでの動作を確認

  • Resolveボタンが追加されている
    5.png

  • Resolveボタンを押下すると、StateがResolvedに変更される

  • 6.png

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?