Discovery - CI の Location フィールドがどのように設定されるかSummary<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Discovery は、構成アイテム(CI)の Location フィールドを 2 つの方法で設定します。1 つは Discovery Schedule に構成された Location を使用する方法、もう 1 つは CI に割り当てられたユーザーから導出される Location を使用する方法です。この記事では、それぞれの方法について、それを担当する Business Rule および Sensor Script を含めて説明します。なお、CI の正確な Location を Discovery がベースシステム機能を使用して取得することはできません。 Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } すべて Instructions<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Discovery は 2 つの方法で CI の Location フィールドを設定します。Location が方法 1 によって設定された場合、方法 2 はそれを上書きしません。その逆も同様です。 方法 1 — 割り当てられたユーザーから取得した Location CI に担当者(assigned_to フィールド)がある場合、Discovery はレコード更新後にそのユーザーの Location フィールドから Location を取得します。 たとえば、Location = "INDIA" のユーザーが CI の assigned_to に設定されている場合、CI の Location は INDIA に設定されます。 この動作を担当する Business Rule Script: if(!current.assigned_to.location.nil()) { current.location = current.assigned_to.location;} 次のサンプル URL を使用して、インスタンス上の Business Rule を参照してください。 <instance-name>.service-now.com/sys_script_list.do?sysparm_query=nameSTARTSWITHUpdate%20location%20as%20needed%5Ecollection%3Dcmdb_ci&sysparm_view= 方法 2 — Discovery Schedule から取得した Location Discovery Schedule を使用して CI を検出する場合、Discovery はその Discovery Schedule 上で構成された Location を使用して、CI の Location フィールドを設定します。Location フィールドが Discovery Schedule フォーム上に表示されていない場合は、フォームビューに追加してください。 Discovery Schedule の Location フィールドに値が設定されている場合、そのスケジュールで検出されたすべての CI の Location フィールドは、Discovery 実行中にその値へ設定されます。Discovery Schedule の Location フィールドが空白の場合、検出された CI の Location フィールドは空のままになります。Quick Discovery 実行の場合、Location は実行を開始したユーザーの Location に基づいて設定されます。 この動作を担当する Sensor Script は、現在の Discovery の Location を取得し、現在の Sensor に対する Location の SysID を返します。見つからない場合は null を返します。 getLocationID: function() { if (typeof(this._locationID) !== 'undefined') // initialized on demand by this method. return this._locationID; this._locationID = null; // initialize var scheduleGr = new GlideRecord('discovery_schedule'); if (!scheduleGr.get(g_status.scheduleID)) return null; if (!scheduleGr.location) return null; this._locationID = ''+scheduleGr.location.sys_id; return this._locationID; 次のサンプル URL を使用して、インスタンス上の Sensor Script にアクセスしてください。 <instance-name>.service-now.com/nav_to.do?uri=%2Fsys_script_include.do%3Fsys_id%3D778011130a0a0b2500c4595ad1d1d768 注: CI の正確な Location を Discovery がベースシステム機能を使用して取得することはできません。 Related Links<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } How to pass discovery schedule fields to a CI record via discovery What changes the Location attribute on CMDB CI records?