HR ケースからナレッジ記事を作成できるようにする UI アクションの作成

  • リリースバージョン: Xanadu
  • 更新日 2024年08月01日
  • 所要時間:3分
  • ナレッジチェックボックスを HR ケースフォームに追加する UI アクションを作成します。

    始める前に

    必要なロール:admin

    アプリケーションスコープが [ヒューマンリソース (HR):Core]であることを確認してください。

    手順

    1. 移動先 すべて > システム UI > UI アクション.
    2. [新規] をクリックします。
    3. 次のフィールドに入力します。
      表 : 1. [UI アクション]フォーム
      フィールド 説明
      名前 ナレッジを作成
      テーブル HR 事例
      アクション名 create_knowledge
    4. [クライアント] チェックボックスをオンにします。
    5. [リスト v3 互換] チェックボックスをオンにします。
    6. [フォームボタン] チェックボックスをオンにします。
    7. [Onclick] フィールドに、「createKnowledgeClient()」と入力します。
    8. [条件] フィールドに、「gs.getProperty("sn_hr_core.enable_kcs_hr") == 'true' && new global.CSMTableMapUtil (current).findMapByName("sn_hr_core.hr_case_kcs_article") && new global.KBKnowledge().canCreate()」と入力します。
    9. [スクリプト] フィールドに次のコードを入力します。
      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("sn_hr_core.hr_case_kcs_article");
          var targetURL = map.getTargetURL();
          var referenceLink = 
      "&sysparm_collection=sn_hr_core_case&sysparm_collectionID="+current.sys_id+"&sysparm_collection_key=task&sysparm_link_collection=m2m_kb_task&sysparm_collection_related_field=kb_knowledge&sysparm_referring_url=sn_hr_core_case.do%3fsys_id%3d"+current.sys_id;
          if(targetURL)
              action.setRedirectURL(targetURL[0]+referenceLink);
      }
    10. [送信] をクリックします。