インシデントからナレッジ記事を作成できるようにする UI アクションの作成
ナレッジチェックボックスをインシデントフォームに追加する UI アクションを作成します。
始める前に
手順
- 移動先 システム UI > UI アクション.
- [New] をクリックします。
-
次のフィールドに入力します。
表 : 1. [UI アクション]フォーム フィールド 説明 名前 ナレッジを作成 テーブル インシデント アクション名 create_knowledge - [クライアント] チェックボックスをオンにします。
- [リスト v3 互換] チェックボックスをオンにします。
- [フォームボタン] チェックボックスをオンにします。
- [Onclick] フィールドに、「createKnowledgeClient()」と入力します。
- [条件] フィールドに、「gs.getProperty("enable_kcs_incident") == 'true' && new global.CSMTableMapUtil (current).findMapByName("incident_kcs_article") && new global.KBKnowledge().canCreate()」と入力します。
-
[スクリプト] フィールドに次のコードを入力します。
function createKnowledgeClient() { if (g_form.modified) { alert(new GwtMessage().getMessage('You have unsaved changes. Please save them to continue.')); }else{ //Call the UI Action again but skip the 'onclick' function gsftSubmit(null, g_form.getFormElement(), 'create_knowledge'); //MUST call the 'Action name' set in this UI Action } } //Code that runs without 'onclick' //Ensure call to server-side function with no browser errors if (typeof window == 'undefined') CreateKnowledgeServer(); function CreateKnowledgeServer(){ current.update(); var map = new global.CSMTableMapUtil (current); map.findMapByName("incident_kcs_article"); var targetURL = map.getTargetURL(); if(targetURL) action.setRedirectURL(targetURL[0]); }