すべてのフィールドまたは複数のテーブルのフィールドに対するディクショナリ属性の設定Issue ディクショナリ属性は、ディクショナリレコードが記述するテーブルまたは要素の動作を変更します。管理者はディクショナリ属性を追加または変更できます。この記事では、テーブル内のすべての列に対して指定された属性を設定する JavaScript スクリプトを提供します。これにより、多数のテーブルおよびフィールドに属性を手動で追加する必要がある場合の作業時間を短縮できます。たとえば、親テーブルから継承されているためコレクションレベルで無効化できないテーブルに対してテキストインデックス作成を無効化する場合などに役立ちます。 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: ; } } すべてのリリース Resolution 属性の追加 テーブルまたはフィールドに属性を追加するには、ディクショナリエントリの System Dictionary レコードに移動し、Attributes フィールドに属性を追加します。属性はカンマ区切りです。ディクショナリレコードに既存の属性がある場合は、新しい属性を追加する前にカンマ(スペースなし)を追加してください。 この方法は、特に多数のテーブルおよびフィールドに属性を追加する場合、時間がかかることがあります。この記事の JavaScript を使用すると、テーブル名および属性文字列を指定して、そのテーブル内のすべての列に対して属性を設定できます。 詳細については、ServiceNow 製品ドキュメントの Dictionary attributes を参照してください。 JavaScript 実行する前に、スクリプトの先頭にある次の変数を変更してください。 vTableName をターゲットテーブルの名前に設定します。適用する属性文字列に vAttribute を設定します。変更を書き込むことなくプレビューするには vDryRun を true に設定し、変更を適用するには false に設定します。 var vTableName = 'cmdb_ci_printer'; var vAttribute = 'no_text_index=true'; var vDryRun = false; // set this to false when you're ready to do the change // Do Not Modify below this line bulkUpdateTableAttributes(vTableName, vAttribute, vDryRun); function bulkUpdateTableAttributes(pTableName, pAttribute, pDryRun) { var gr = new GlideRecord('sys_dictionary'); gr.addEncodedQuery('name=' + pTableName + '^element!=NULL'); gr.query(); var bUpdate = false; while (gr.next()) { var vAttributes = gr.attributes; var nLength; if (vAttributes) { nLength = vAttributes.length; } else { nLength = 0; } if (0 == nLength) { // There are no other attributes, just set it gr.attributes = pAttribute; bUpdate = true; } else { // Attributes is not empty, check to see if we have it set already: var n = vAttributes.indexOf(pAttribute); if (-1 == n) { // The attribute is not set, so append it: gr.attributes = vAttributes + ',' + pAttribute; bUpdate = true; } else { // The attribute is set; do nothing } } if (!pDryRun) { if (bUpdate) { gs.print('Updating record sys_dictionary.do?sys_id=' + gr.sys_id + ' to ' + gr.attributes); gr.setWorkflow(false); gr.update(); } } bUpdate = false; } }