ターゲットインスタンスでのクローン作成後クリーンアップスクリプトの強制実行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: ; } } 何らかの理由でクローン後のクリーンアップスクリプトがクローン後のターゲットインスタンスで実行されなかった場合は、以下のスクリプトを使用して強制的に実行してください。 これにより、 clone_cleanup_script テーブルに基づいてスケジュール済みジョブが作成されます。 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 SOURCE インスタンスで Scripts > Background に移動します。クローンに使用されたクローンプロファイルを確認します。以下のスクリプトをコピー&ペーストし、実行する前に Background scripts フォームで以下の設定になっていることを確認します。 Scope ==> GlobalRecord for rollback? ==> オフExecute in sandbox? ==> オフCancel after 4 hours? ==> オフクローンでプロファイルを使用した場合は、変数 profileSysId にそのプロファイルの sys_id を追加します。// これは非常に重要です。プロファイル固有のクローンクリーンアップスクリプトが含まれている可能性があるためです。 var profileSysId = ""; // blank = no profile var output = ""; var scriptIds = {}; // ------------------------------------------------- // No profile specified // Export all active cleanup scripts // ------------------------------------------------- if (!profileSysId) { var cleanup = new GlideRecord("clone_cleanup_script"); cleanup.addActiveQuery(); cleanup.orderBy("order"); cleanup.query(); while (cleanup.next()) { output += "\n\n"; output += "// =====================================\n"; output += "// " + cleanup.name + "\n"; output += "// Order: " + cleanup.order + "\n"; output += "// =====================================\n\n"; output += cleanup.script + "\n"; } } else { // ------------------------------------------------- // Get System Profile // ------------------------------------------------- var systemProfileId = ""; var systemProfile = new GlideRecord("clone_profile"); systemProfile.addQuery("name", "System Profile"); systemProfile.query(); if (systemProfile.next()) { systemProfileId = systemProfile.getUniqueValue(); } // ------------------------------------------------- // Collect cleanup scripts from System Profile // ------------------------------------------------- if (systemProfileId) { var systemM2M = new GlideRecord("clone_profile_cleanup_scripts"); systemM2M.addQuery("clone_profile", systemProfileId); systemM2M.query(); while (systemM2M.next()) { scriptIds[systemM2M.cleanup_script.toString()] = true; } } // ------------------------------------------------- // Collect cleanup scripts from selected profile // ------------------------------------------------- var profileM2M = new GlideRecord("clone_profile_cleanup_scripts"); profileM2M.addQuery("clone_profile", profileSysId); profileM2M.query(); while (profileM2M.next()) { scriptIds[profileM2M.cleanup_script.toString()] = true; } // ------------------------------------------------- // Retrieve scripts and build output // ------------------------------------------------- var cleanup = new GlideRecord("clone_cleanup_script"); cleanup.addActiveQuery(); cleanup.addQuery("sys_id", "IN", Object.keys(scriptIds).join(",")); cleanup.orderBy("order"); cleanup.query(); while (cleanup.next()) { output += "\n\n"; output += "// =====================================\n"; output += "// " + cleanup.name + "\n"; output += "// Order: " + cleanup.order + "\n"; output += "// =====================================\n\n"; output += cleanup.script + "\n"; } } gs.print(output); 5. このスクリプトの出力を取得します。この出力には、すべてのスクリプトが 1 つの大きなスクリプトとして含まれているはずです。 6. TARGET インスタンスにログインします。 7. Scheduled Jobs に移動し、New をクリックします。 8. 名前を入力し、数分後に実行されるよう設定します。 9. ソースの結果をスクリプトに貼り付けます(1 行目の *** Script: は含めないでください)。