複数の資産を持つユーザーに関するレポートを作成するSummary<!-- /*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: block; max-width: ; width: auto; height: auto; } } この記事では、ユーザーが複数の資産に割り当てられている場合にsys_userテーブルからデータを取得する方法について説明します。 たとえば、cmdb ci コンピューターと cmdb ci IP 電話の両方を持つユーザーのリストを取得するには、次のようにします。このシナリオでは、Fred Luddy に cmdb ci コンピューターと cmdb ci IP Phone が割り当てられているとします。 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: block; max-width: ; width: auto; height: auto; } } Instructions<!-- /*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: block; max-width: ; width: auto; height: auto; } } 次のようにスクリプトインクルードを作成します。 var getUsersWith2Devices = Class.create();getUsersWith2Devices.prototype = Object.extendsObject(AbstractAjaxProcessor, {getUserWithBothAssets: function() {var arry = [];var gr = new GlideRecord('sys_user');gr.addActiveQuery();gr.query();while (gr.next()) {var lap = new GlideRecord('cmdb_ci_computer');lap.addQuery('assigned_to', gr.getValue('sys_id'));lap.query();if (lap.next()) {var ph = new GlideRecord('cmdb_ci_ip_phone');ph.addQuery('assigned_to', gr.getValue('sys_id'));ph.query();if (ph.next()) {arry.push(gr.getValue('sys_id')+'');}}}return arry.toString();} }); sys_userテーブルでレポートを作成し、スクリプトインクルードを呼び出します