サービスポータルのウィジェットを介してサーバーからクライアントにテーブルのフィールド値を渡す方法Issue <!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } サービスポータルウィジェットを使用して、テーブルからクライアント側にフィールド値を渡す方法について説明します。 サービスポータルウィジェットは、データオブジェクトを使用してサーバースクリプトとクライアントコントローラーをバインドします。このデータオブジェクトに変数またはプロパティを追加することで、サーバーからクライアントにフィールド値を渡すことができます。 Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } サポートされているすべてのリリース Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } 次の例では、ウィジェットを使用して、ユーザー [sys_user] テーブルからユーザーの名と姓をブラウザコンソールに表示します。 1. 新しいウィジェットを作成します。 2. 以下の Body HTML テンプレートを追加します。 <div class="panel panel-default">> <button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction('Show')">Just Do It!</button></div> 3. 以下の Server スクリプトを追加します。 (function() { /* populate the 'data' object */ /* e.g., data.table = $sp.getValue('table'); */ var userRecord = new GlideRecord('sys_user'); userRecord.addQuery('sys_id', 'sys_id_of_a_user'); //Add any other condition - This is a sample userRecord.query(); var user = {}; //User's record object containing values if(userRecord.next() && input && input.action){ data.user = user; if(input.action == 'show'){ data.user.first_name = userRecord.first_name.toString(); data.user.last_name = userRecord.last_name.toString(); } }})(); 4. 以下のクライアントコントローラーを追加します。 function() { /* widget controller */ var c = this; c.server.update(); //overwrites the data object with new updated contents console.log("User's first Name: " + c.user.first_name); console.log("User's first Name: " + c.user.first_name);} 5. このウィジェットをページに追加し、サービスポータルでそのページを開きます。 6. ウィジェットを選択し、ブラウザコンソールで期待どおりのデータを確認します。 注: ウィジェットはサービスポータルページのカタログ変数にアクセスできないため、カタログ変数を使用してページを操作することはできません。 Related Links<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Performance Analytics widgets