1
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?

More than 1 year has passed since last update.

プリザンターのサーバースクリプトで、編集画面を開いたときのユーザーによってボタンの表示・非表示を自動で切り替える

Posted at

はじめに

編集画面を開いた際、ログインしているユーザーが「新規作成者」、もしくは「管理者」であれば画面下部に「参照コピー」ボタンを表示し、そうでなければ「参照コピー」ボタンを非表示にする

ソースコード


//ログインしているユーザーIDを取得
const loginUserId = context.UserId;
//レコードの新規作成者IDを取得
const createUserId = model.Creator;
//レコードの管理者IDを取得
const managerUserId = model.Manager;
//ログインしているユーザーIDと新規作成者ID、もしくはログインしているユーザーIDと管理者IDが同じであれば処理続行
if (loginUserId == createUserId | loginUserId == managerUserId) {
    //参照コピーボタンを表示
    elements.DisplayType('ReferenceCopyCommand', 0);
//そうでなければ処理続行
} else {
    //参照コピーを非表示
    elements.DisplayType('ReferenceCopyCommand', 3);
}

工夫

特に工夫はない。しかし、JavaScriptには(==)と(===)で違う意味があることに今回気が付きました。詳細はほかの記事に投稿しています。

1
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
1
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?